It is shown that the antisymmetrized geminal power wavefunction (AGP) in the macroscopic limit and the Bardeen-Cooper-Schrieffer (BCS) superconductivity model with fixed mean number of electrons coincide to arbitrary order in deviations from the extreme-type function which is considered as the carrier of the superconductivity property. Variational equations for the AGP in the macroscopic limit are formulated in terms of two sets of parameters, E i and Ai, which under simplifying assumptions reduce to eigenvalues of the open-shell Roothaan one-electron Hamiltonian and to the BCS energy gap parameter, respectively. The superconducting state is shown to be stable for the solution of these equations with a macroscopic number of non-zero Ai and of degenerate E i = E z at the Fermi level E v. The macroscopic contribution to the maximal pair occupation number which is responsible for the superconductivity is expressed as a mean value of A~/[(e i -ev) 2 + A~]. The formulated non-zero temperature version of the equations for e~, A~ is able to describe the superconducting phase transition. On this ground the necessary condition of stabilization of the superconducting state is formulated that is the existence of the macroscopic-fold near-degenerate and almost half-filled level. As is shown it is realized in the energy band structure of doped fullerides, copper oxide ceramics and perovskite-type crystals, e.g. BaBiO 3. The additional requirement of negativity of exchange interelectron-interaction integrals may be satisfied not only by the known vibronic mechanism but also, as is demonstrated, by the polarization potential of an environment in a plane layer of stratum structures.