In Iran something has to give. I went looking for what it was. I took a taxi to the north of Tehran. I had heard that this was where I could find the secret basement. In an ordinary street at an ordinary block I rang the buzzer. I opened the door, went inside and suddenly it hit me. From somewhere, deep in the depths, I could hear music. It was coming from underground - literally - a rich mix of western rock and eastern melody.

In the basement, a young entrepreneur has opened a recording studio. Hardly remarkable anywhere else - but this is the Islamic Republic of Iran, a country officially dedicated to a fundamentalist vision of Islam, as set down by Ayatollah Khomeini in the aftermath of the 1979 revolution. It was a revolution that rejected western values, and the "pollution" of western culture. In that, at least, it is a revolution that is crumbling.

Down in the basement, a man with an uncanny resemblance to the Sgt Pepper period John Lennon is recording a CD. With him, in the hot, stuffy studio, is a bassist dressed in black, a drummer and a 10-year-old Afghan boy playing small tambour drums. Behind the glass, a sound engineer is flicking switches and twiddling knobs. A girl in jeans, T-shirt and trainers is slouched on a sofa with a young man. Two other girls are watching the session. Not having visited the underground before, I am taken aback. The girls are not wearing the full, officially decreed women's dress code. This includes covering one's hair for fear of "stimulating" any man who might see it.

This discreet studio is one where Tehran's underground bands come to record. It is as if I have stepped through the looking glass into another country. Above us, in the streets, is the Iran of women in all-enveloping black chadors, vast murals of revolutionary martyrs and officially sanctioned demonstrations where thousands chant the old slogans of "Death to America" and "Death to Israel". Here, I am in another, freer Iran that exists in parallel with the Islamic republic. In Iran, there is the public face of conformity with Islamic rules and regulations and the private face, which, as often as not, shuns, ignores or even despises its strictures.

In 1997, Mohammad Khatami, a reformist clergyman, was elected president with a massive 69% of the vote. Since then, Iranian politics has been a bitter struggle between reformists and conservatives led by Ali Khamenei, the official successor as Supreme Leader to Ayatollah Khomeini. Iranian politics is Byzantine but, put simply, conservatives, operating in the judiciary or Islamic councils, have been blocking reforms proposed by the reformist-dominated Majlis or parliament. But, from the evidence I have seen, while the politicians are fighting, the very ground is shifting under their feet. Iran is in the throes of a social and cultural revolution. Reformers are trying to keep pace with it. They want the state and its government to adapt and survive, to preserve and to modernise an Islamic government before it becomes too rickety and outmoded and is simply swept away. The conservatives want to turn back the clock.

Iran, and especially the vast metropolis of Tehran, with its 12 million strong population, has changed dramatically with the onset of global music and the internet and an ever-stronger desire for personal freedom. And in the wake of modernisation have come the usual evils: prostitution, drugs and, for many young people, alienation, too. The evidence of change is clear for all to see, at least in the big cities. Wherever there are computers, for example, teenage girls wearing the hejab head covering or headscarves are bobbing about, headphones clamped to their heads, as they download music from a world away. They are listening to Shakira, watching Eminem videos or internet chatting to their boyfriends across town or to cyberfriends in London and LA.

In the aftermath of the Islamic revolution, and following Saddam Hussein's attack on Iran in 1980, the mullahs demanded martyrs. Women were encouraged to go forth and raise children. The result was a massive baby boom but, for the mullahs, the grand scheme has gone dreadfully wrong. The statistics are stark. Two thirds of Iran's 70 million people are under 30 and - far from creating a nation of martyrs - the mullahs have created millions of angry young people who would rather check their email than die for Islam. They do not want to be beaten on the streets if their headscarf is pushed too far back, and they don't want to be beaten by the Basij, the Supreme Leader's volunteer Islamic militia, because they are out with a girl who is neither their sister nor their wife.

Their anger does not necessarily translate into political action - at least, not yet. Some of the mullahs are aware of their problem and have talked publicly about the failure of the Islamic state to engage its young. At the beginning of 2000, for example, one of them, a reformist mullah called Mohammad Ali Zam, shocked Iranians by announcing publicly that research had shown that 73% of Iranians - and 86% of students - did not say their daily prayers. Little of this more secular side of Iran is reported in the west, because of the restrictions facing both foreign and local journalists. Still, one figure that did leak out was a finding that the Ministry of Interior tried to keep secret: according to research among 16,000 people, 94% said the country was in urgent need of reform. Hossein Ghazian, the director of the polling firm Ayande, says that his research points in a similar direction - the majority believe in the present regime, but they want change; and 23% want radical change - that is to say, a revolution. As to religion, Ghazian has found "that 36% say religion should be private and in your heart, and is nothing to do with ritual", and a similar proportion think religion and state should be separated - a marked change from 10 years earlier.

Back in the studio, the recording session is over. The Lennon lookalike, Farman Fath-Alian, who is 31, has succeeded in releasing one album, but a CD of his has been blocked for the past five months at the Ministry of Guidance and Islamic Culture, known as Ershad, which must give permission for music to be sold and for concerts to be held. Some 30 underground studios have mushroomed across Tehran and, although they have applied for permission, it has neither been granted nor refused. The authorities don't want the country polluted by western-style music but, equally, they don't want to antagonise the young.

Farman's music is familiar to a western ear - but his Farsi lyrics draw from the Sufi mystics, whose liberal version of Islam is something that sits uncomfortably with a strict Shia Islamic interpretation. So, while the lyrics can be interpreted as mystical religious songs, they might also be interpreted as love songs. One of the two lyrics that Ershad is objecting to contains the words "rest on my knee".

Farman's bassist is 32-year-old Babak Riahipour. Until June, he was with O-Hum, an alternative rock band that used the same philosophy as Farman. The music was vital and modern, but the lyrics were those of Hafiz, a 14th-century poet and Iran's answer to Shakespeare. Hafiz provided the metaphors, but Ershad wasn't having it. "They said our music was provocative." Dancing, of course, especially between unmarried girls and boys, is strictly forbidden here. When bands do get permission to give concerts, security officials keep a strict eye on the audience, who are penned into their seats, nodding their heads or upper bodies as much as they dare. "Once, I played a concert where there were 5,000 people," says Riahipour. "One guy got up and started dancing, and they beat the shit out of him."

After three years, tired of the struggle with officialdom, O-Hum broke up. Two of its members have gone to Canada, but Riahipour says that he believes the future is here. "O-Hum in Canada or the US is nothing special. Alternative rock abroad is nothing special. The special thing we had was to be in Iran and use Farsi lyrics and play to our own people."

Only a few western films are screened at the cinema - but there is probably no film, from hardcore porn to the latest Hollywood blockbuster, that is not widely available under the counter or from a video rental deliverymen. Today, the authorities are trying - and failing - to hold the line against satellite television. Walk the streets, and you see nothing, but climb on to the roof of a tall building and it's a different story. Like clumps of giant mushrooms, the dishes are everywhere on top of Tehran's flat roofs, or hidden behind bamboo screens on balconies.

Every now and then, the authorities make a sweep. Dishes and receivers are confiscated, or bribes are demanded for a blind eye to be turned. But the authorities are right to fear satellite television. Several Iranian exile stations are now broadcasting from the US, and there is even one from an armed group based in Iraq. The US stations have political chat shows that, as often as not, are filled with ageing monarchist exiles pouring out their bile against the Islamic republic - and each other. But they also show modern Iranian pop and dance groups working abroad - and Reza Pahlavi, the 41-year-old son of the last Shah of Iran.

Once a forgotten figure, the US-based pretender to the Peacock throne is now frequently seen repeating a mantra of democracy and secularism. This is not to say that the monarchy has a real chance of restoration, but Pahlavi on TV has had an effect - many young people, who have no memory of his father's repressive regime, have been favourably impressed. Muhammed, 19, who works in his father's restaurant, says, "Me and my friends like [Pahlavi] because we heard from our fathers that the time of the Shah was a time of comfort, not like now, so, if he came back, that would come back, too."

Two years ago, 500,000 Iranians had access to the internet. Today, that number is believed to be 1.75 million, and is expected to grow to five million in the next five years. The number of Farsi sites is still limited - there are perhaps only 40,000 of them - but they provide another window on the world. The computer has become particularly important in the lives of girls, often confined to home by traditionalist parents who have little idea what their daughters are doing online. "Teenage girls know more about sex than I do," says Mabobeh Abbasglizadeh, a women's rights activist. And sex and internet chatting aside, Iranian girls are leading the way as Persian blog queens. A blog, for the uninitiated, is a weblog, a kind of diary or journal posted on the internet. Bloggers, as they are known, provide links to each other and can hide behind the web's anonymity to say whatever they like, uninhibited by the fear of being identified or, as might be the case in Iran, caught or punished.

Many blogs, Iranian and foreign, are numbingly boring accounts of people's daily lives, but Iranian girl bloggers are catching attention for their spicy and articulate mix of politics, dirty jokes, acid comment and worries about their weight. Here, a typical Iranian girl blogger airs her views on a recently discussed scheme to institutionalise an Islamic concept of the "temporary marriage", which many feminists believe would simply amount to legalised prostitution. Clearly, she disagrees with the feminist objection, writing that "maybe some of our problems on the streets are because we didn't have anything like this". But she also disagrees with some of the conditions regulating when men could use this facility: for example, the notion that men could have recourse to "temporary marriages" and the proposed, Orwellian-named "chastity houses" if they were travelling or their wife was sick. Outraged, she demands to know, "Why does masturbation exist?"

In another entry, she simply lets rip: "I hate those people who pray and with their prayers make our life a disaster. I hate all those dumb people who go to those marches and shout, 'Down with America'. I hate those people I am supposed to bribe for no reason." And then: "I hate cigarettes, I hate men and I hate my emotions as a woman. I hate that feeling of lust, and I hate my big nose." In a country where a court can sentence a woman to be stoned to death, such words amount to outrageous sedition and heresy. Sina Motallebi, who writes for the newspaper Hayat-i No, also has a weblog where he makes political comments. These are often censored by the newspaper's editors, who don't want to overstep an ill-defined political boundary and find themselves shut down, the fate of many papers over the past few years. Motallebi says, "There is a lack of freedom of speech in Iran, so weblogs are a good opportunity, especially for younger people, to explain their views and attitudes, because they can't explain them in any other media. They are a good way to exchange news, so they are a way to freedom and democracy, but it's still very young, less than a year old."

Some people are simply too scared to speak to western journalists. It took a week to fix a discreet place and time to talk Maryam, 24, a student of industrial design, and two of her friends. What was the worst thing about life in Iran for young people, I asked her. She grabs her manteau, the officially ordained overall gown she has to wear, and says "the clothes. They are like a torture. I hate them." In the street, she and her friends get hassled by the Basij or the police if their manteaus are too short or revealingly tight. At university, girls are told to remove make-up. In June, a period of relative relaxation ended when aggressive morality enforcers appeared on the streets in brand new Land Cruisers. The unconfirmed rumour was that many of these men were Palestinians and Lebanese, whose various organisations were now repaying their debt to Iran for help received. "We get angry, but we are used to it," says Maryam. "Is it possible to have a party without someone knocking at the door? All we want is a normal life."

One of the ironies of Iran's social revolution is that, in part, Islamic strictures have led to an undermining of the values they were supposed to uphold. Today, there are more women than men at university. Conservative families, who in earlier generations would never have allowed their daughters to go on to higher education, have allowed them to study, reassured by the system's strict Islamic guidelines. Many girls, too, have jumped at the chance of university, as much to escape forced teenage marriages as for the opportunity to study. Once their studies are over, it is, of course, that much more difficult for these girls to return to their preordained role as submissive daughters.

While it is clear that the system is straining to cope with the changing demands of young people, it is also clear that the state is in difficulties economically. Iran's baby boomers now need jobs, and to keep them all gainfully employed the state needs to create up to one million new jobs a year. It is barely coping, and figures for unemployment range from 14%-20%. And, of course, unemployment, rampant inflation and tough times economically all combine to produce a downside to change, including appalling hardships for many.

Drug addiction is rife. While rich kids from the wealthier northern suburbs of Tehran pop ecstasy tabs and smoke dope, heroin and opium addiction are claiming an awful toll in the poorer south of the city. Drugs are freely available (as is strictly illegal alcohol), and the number of addicts is now believed to be between 1.2 million and two million people. Many believe that part of the problem is that corrupt policemen are in league with the dealers in exchange for a share of the profit.

Surprisingly, for a state that trumpets its moral values, prostitution is also now widespread - and, as anywhere else, prostitution and drug addiction are often intertwined. As dawn breaks, it is easy to find chador-clad and probably heroin-addicted working girls sleeping rough in Tehran's parks. (Unsurprisingly, HIV and Aids are now very much on the public health agenda of the Islamic Republic.) Many of these girls are runaways. They have often fled abusive, violent or drug-addicted parents, according to the women's rights activist, Mabobeh Abbasglizadeh, or they might be simple country girls who've seen the bright lights of the city on television and balk at the prospect of an early, joyless marriage to a much older man. Some of the runaways have fallen in love and slept with a boy who has quickly dumped them. In panic, they have fled before their family finds out that they have lost their virginity - or literally fled for their lives because their fathers and brothers have found out that their family's honour has been besmirched.

An average of 30 runaway girls are found every day, confused, scared and lost, in Tehran's four intercity bus terminals, says Abbasglizadeh. "And if we find 30 girls in one day, then maybe there are 100." Tucked in the corner of Tehran's south bus terminal is a place ringed with a high-security fence called the Green House. This is the first stop for freshly caught runaways, girls, boys and other delinquents.

Late on a typical recent afternoon, Fatimah and a boy, as yet unidentified, had been hauled in. Fatimah is in shock; tears are streaming down her face. "I want to go home," she wails. "I want to go to my mother! Call my mother, please, call my mother!" In the next room, the boy, who is sporting a baseball cap, looks smug and relaxed. Maybe he has been through this before. Fatimah will soon be facing a compulsory virginity test administered by a police doctor. The result may have a dramatic effect on the rest of her life. Shrouded in a chador and made up, she looks 17 - but her identity card reveals that she is just 14.

According to Nargess Pourjamali, the social worker on duty, the couple had just arrived on a bus from provincial Esfahan. "First the boy said she was his wife and now he says he doesn't know her. Perhaps they wanted to come here just for fun." Fatimah is now wailing that her father is dead, her mother remarried and her new stepfather would not have her in their home. She lived with an uncle and cousins who beat her. "Yesterday," says Fatimah, now gasping with tears and terror, "I was sleeping; they beat me, and kicked me out of the house." She comes from faraway Lorestan. She got to the bus station in the city of Esfahan, where she was picked up by the boy. Telling a hotel clerk they were married, they secured a room for the night. The next morning they took the bus to Tehran. If the authorities determine that the boy slept with her, they may well be forced to marry. If it is determined that he is working for a gang snaring runaways for prostitution or trafficking (Iranian girls are often sent to Dubai for onward sale in the Arab world), he may be imprisoned and her fate will hang in the balance.

Many of the girls are sent home, many end up back on the streets, and the lucky ones are sent to a refuge. Typically, they are aged 15-16, but some are as young as 12. In Tehran, some surgeons specialise in restoring a girl's virginity, technically speaking at least. This illegal operation costs $50. According to Abbasglizadeh, "Often, the mother knows but the father does not know anything." Abortion is, of course, also illegal, except under certain conditions such as a threat to the woman's life. So, a backstreet abortion can cost as much as $500.

Bloggers and runaways, rock bands, prostitutes and girls who just want to have fun are all part of the picture of a young, changing Iran. But, of course, they are only part of it. At least one-third of the electorate staunchly resists reform. Although it is hard to generalise, these people tend to be older, less well educated and poorer. But it's not always the case. Spend Thursday night at the vast, hangar-like shrine of Ayatollah Khomeini just south of Tehran, and you'll notice a strong contingent of young among the faithful. As they grip the grille that surrounds the actual tomb, their faces sometimes show an ecstatic calm; some of them simply burst into tears.

Not so far away, inside a typical mosque in the modest south Tehran district of Afsarieh, young Basij (the volunteer militia) are gathering. Some are learning the Koran while 25 boys aged 10-12 are drilling and learning about the Kalashnikov. Amir Parish, their 21-year-old instructor, is saying, "The ammunition clips hold 30 to 40 bullets", and then shows them the individual parts of the gun. On cue, the boys shout, "Allah Akbar!" - "God is Great!" - and disband happily for the evening, each clutching a leaflet about the ongoing Palestinian intifada. On television here a suicide bombing is called a "martyrdom-seeking operation".

In a corner of the mosque is a memorial to the 58 members of this mosque who died during the Iran-Iraq war. A kind of tableau has been made in a glass-topped case with sand, boots, a lantern, identity cards, a watch and a bullet-riddled helmet. During the war, the Basij played a key role, with children being sent on "martyrdom-seeking operations" to clear minefields. The local Basij chief permits me to speak to some of his older recruits. I ask Abulfazl Youssefi, 21, what it means to him to be in the Basij. He says, "It means love. Love of the system and the Supreme Leader. We will give our life for the Supreme Leader." Just outside the mosque, Ali Mohamed Rahimi, 15, tells me he is in the Basij "because the Supreme Leader tells us to. I love it. I like the military training and the debates." Interestingly, however, only two out of 30 boys in Ali's class at school have heeded the Supreme Leader's call. They call Ali names, "insult the whole Basij, and write bad words on the wall, like 'Down with Khomeini'".

Listening to this is a 19-year-old called Bijan. He has something to say, but it is too dangerous here. We go to talk in the night-time gloom of a nearby park. He tells me that "among young people especially, the Basij are hated. In the name of religion, they took everything from us." He pours out his bile, saying that many older Basij are simply members for any benefits they can extract, and often hypocrites, too. "At the end of the street there is one Basij who owns a shop. Under the counter he rents porn movies that he copies." Our conversation is cut short. A policeman and a soldier demand to see our papers. The policeman says, "The Basij reported you. They think you could be spies."

Back up in the wealthy north of the city, I spend an evening at the Golestan shopping mall. I spot several girls in tight manteaus with plastered noses. Because it is early in the summer holidays, this is deemed the best time to have your nose fixed. Groups of boys with slicked-back hair, clustered near the Boof fast-food restaurant, are talking into their mobile phones. One tells me that he and his friends are planning a party. There'll be drugs, music and girls.

The house is in a quiet suburb, but the police, knowing that this is where kids go to party, throw up roadblocks. So, a scout has been sent out. If he reports that the coast is clear, the rest will follow, girls and boys in separate cars, of course. When I told some reformist activists what type of people I had been talking to, they scoffed. Instead of searching out what they regarded as frivolous stuff, why wasn't I reporting, say, on the otherwise unknown case of the five young human rights activists in the provincial town of Hamedan who had been slammed in jail for their work? Or what about Iran's up-and-coming generation of exciting young artists? They have a point, but human rights activists, and even, maybe, artists, are the exceptions. And, from what I have seen, there are many more out there, discontented and drifting dangerously. When those Basij boys told me that they would willingly die to defend the revolution, I thought that if their leaders succeed in blocking reforms for too much longer, then one day they may well have to do just that