To extract the atrial activity (AA) from the ventricular activity (VA) in atrial fibrillation (AF) episodes is a must for clinical analysis. We present a methodology to achieve this goal minimizing the number of leads and optimizing its localization starting from a body surface potential mapping (BSPM) recording. We present the acquisition system and the methodology, which consists on: apply independent component analysis (ICA) to obtain a statistically independent representation of the data, apply the prior about the AA to identify it, and to find the contributions of each lead to the AA, obtaining finally the optimal leads necessary for the extraction. Following this procedure, we show that with only two leads the AA and VA can be recovered, so this technique is a very promising one in order to long term ECG recordings where the number of leads must be reduced. In addition, this procedure can be extended to other ECG-based problems where the ICA assumptions are satisfied