After several years of prayer and preparation, two Brooklyn women were consecrated as virgins yesterday during a Catholic ceremony that was last performed in the diocese in the mid-19th century.

At a time when sex is seemingly everywhere but virginity is in the news – thanks to pop star Britney Spears’ pledge of abstinence – the women committed themselves to a life of celibacy during the Solemn Rite of Consecration of Virgins for Women Living in the World.

The ceremony dates back to the church’s ancient days and can only be performed by a bishop, in this case Bishop Thomas Daily of Brooklyn, who presided at Cathedral Basilica of St. James in downtown Brooklyn.

“This doesn’t happen very often. It’s an ancient ceremony. But these two young women want to live as lay people,” Daily said. “This is their sacrifice.”

With several hundred looking on, Junette Maria Romero of Flatbush and Angela Scannapieco of Williamsburg donned white wedding-like gowns yesterday, took their vows of celibacy and received rings to mark their status.

“You really have to live a holy life, a life of purity, lots of prayer and works of charity,” said Romero, who was born in Trinidad and teaches religion when she’s not on the job at a Manhattan securities firm.

Romero declined to give her age.

After the ceremony, Scannapieco, 43, hugged well-wishers and proudly showed off the ring that designates her new status.

“It seems this is where God wants me to be out in the world,” she said, comparing her life to that of a nun. Scannapieco works for a church youth ministry and holds a master’s degree in religious studies.