Similar to the Debye-Hueckel plasma, charged groups of oppositely charged polyelectrolytes attract each other. We find exact expression for the correlation free energy of electrostatic attraction in polyelectrolytes within the random phase approximation. The obtained expression is shown to be valid in dilute, semidilute, concentrated solutions, and melts. In this theory we explicitly take into account positions of charged groups on the chains and examine both charge and polymer concentrations fluctuations. The existence of the critical point in theta-solvent is demonstrated. The theory reproduces scaling results and describes the system beyond the scaling approximation. We discuss also the difference and similarity between our theory and the earliest results by Borue and Erukhimovich.