Ballistocardiogram (BCG) artifact is considered here as the sum of a number of independent cyclostationary components having the same cycle frequency. Our proposed method, called cyclostationary source extraction (CSE), is able to extract these components without much destructive effect on the background electroencephalogram (EEG). It is shown that the proposed method outperforms other methods particularly in preserving the remaining signals. The CSE is utilized to remove the BCG artifact from real EEG data recorded inside the magnetic resonance (MR) scanner, i.e., visual evoked potential (VEP). The results are compared to the results of benchmark BCG removal techniques. Analyzing the power spectral density of the cleaned EEG data, it is shown that CSE effectively removes the frequency components corresponding to the BCG artifact. It is also shown that VEPs recorded inside the scanner and processed using the proposed method are more correlated with the VEPs recorded outside the scanner. Moreover, there is no need for electrocardiogram (ECG) data in this method as the cycle frequency of the BCG is directly computed from the contaminated EEG signals.