Hidden in a corner of the atrium of the tiny Feresteh shopping center, right behind Tehran’s only Victoria’s Secret and a traditional pastry seller, the high-end Lime coffee shop is only for those who know where to find it.

The music of pop singer Ricky Martin filled the air as customers ordered $4 shots of espresso and connected to the shop’s wireless Internet with their cellphones. Girls with long hair spilling out from under their obligatory Islamic head scarves giggled shyly as they held hands with their boyfriends.

“People should feel at ease here in Lime,” said the cafe’s owner, Joobin Gharaei. “We want to create a private atmosphere.”

Surrounded by Lime’s art-covered walls, customers could almost forget that they live in the Islamic Republic, where Shiite Muslim clerics advocate a separation of the sexes and pop music and clubs are strictly forbidden.

Iranian law prescribes what people are allowed to do, wear and say in public. Women’s hair must be covered, and showing affection is illegal. Although many people openly voice criticism of Iran’s leaders, there is always the fear that someone will overhear. So most people create their own worlds, at home or at their friend's homes.

Tehran’s coffee shops numbered just a handful 10 years ago. But now hundreds dot the city, with a new one popping up every few days it seems, even in places such as car washes and movie theaters. They are among the very few semi-public places where young people meet and artists and intellectuals debate.

But reality is never far away. On a recent evening, just outside the shopping center where Lime opened its doors in 2009, officers with Iran’s morality police — a unit that controls the streets to “promote virtue and prevent vice” — were stopping cars filled with boys and girls.

They arrested some — almost arbitrarily it seemed — for wearing tight clothes or sitting in a car with someone they were not married to. But none of the young people appeared to be married, and they were all dressed similarly.

It’s better not to be on the streets, said one unmarried couple who are regular customers of the Star, a cafe in an up-and-coming middle-class neighborhood.

“The coffee shops are our hideaways,” said Nima Manzouri, 24, who was there with his girlfriend. “If we hold hands on the streets, we can be arrested. So we come here, spend 10,000 tomans” — about $8 — “and chat.”

But in no way are the coffee shops official free zones, nor are they off limits to the morality police. They are tolerated, but they can easily be closed down.

Last year, dozens of officers raided the Deja Vu cafe in Tehran, loading customers in vans and taking them to interrogation centers. Many received fines, said the shop’s former owner, who spoke on the condition of anonymity for fear of retribution.

“The police told me that women were smoking, but it’s all about boys and girls meeting,” he said. “There are just too many coffee shops for them to close.”

In Cafe Alme, near the campus of Tehran University, young couples gave a nod to the broad-shouldered owner, Abbas, before walking up a small staircase leading to a secluded area. Six months ago the morality police sealed off the section to “prevent flirting,” said Abbas, 30, who did not want his family name given. “I reopened it, because I need customers,” he said.

As Elvis Presley’s “Heartbreak Hotel” played in the background, Abbas poured a latte. “If young people want to be outside of their parents’ houses, coffee shops are often the only place they can afford to go to,” he said.

It is the young people of this capital who are financing the boom in coffee shops, where espresso costs between $2.50 and $5, and sandwiches sell for twice that — expensive for most Iranians. More than 70 percent of Iranians are younger than 35, and although unemployment is high, a segment of the city’s population benefits from oil wealth.

Just opposite Tehran’s Mosalla mosque, an unfinished concrete behemoth reinforced with steel beams, two young women who work at a nearby bank entered Cafe Khiyaban for their daily cigarette break.

“As women, we are not expected to smoke,” one said. “So we come here, drink two teas and smoke as many as we can, sometimes half a pack, and return to work like good girls.”

Hadi, one of the cafe’s owners, said it would be impossible to turn back the clock. “The authorities have to tolerate us,” he said. “Young people need to be able to unwind from the everyday pressures at some place. Here, they can.”