The shift has left clerics and politicians struggling to deal with a generation of young women carving out independent lives in a tradition-bound society, away from the guidance of fathers and husbands. Desperate to stop the trend, the government introduced a campaign to promote quick and cheap marriages — but it backfired, experts said, by cheapening an institution deeply anchored in Iran’s ancient culture.

That has left the young women to develop strategies to fend for themselves in a society where social codes are often based on deep suspicion of female sexuality. Shoukoufeh, who would not give her full name for fear of losing her lease, said that prying eyes often peek through the cracks of doors whenever she walks down the hallway. But she said she draws strength from her parents, who support her choice to live alone.

“They know I want to be independent,” she said decisively. “They understand times have changed.”

In the not-so-distant past, single women had to endure severe social stigmatization, suspected of having loose morals or dismissed as spinsters who were failing to fulfill their role in life.

But that is changing in the big cities, in large part because of their sheer numbers, but also because of the prevalence of satellite television, social media and cheap foreign travel, many Iranians say, which have helped to change attitudes.

University enrollments have been rising strongly in Iran over the last decade, and women now account for nearly 60 percent of the total. Having raised their horizons in four years of college, many of these women have trouble finding husbands they consider their equals.