TEHRAN (AFP) - Campaigning for Irans presidential election wrapped up on Thursday after three weeks of mass rallies, a series of fiery television debates and vitriolic mudslinging among the four candidates. Fridays poll has emerged as a hotly-contested race between incumbent hardliner Mahmoud Ahmadinejad and his main rival, moderate Mir Hossein Mousavi, who is seeking a comeback after two decades in the political wilderness. The campaign has highlighted deep differences in the Islamic republic after four years under Ahmadinejad, whose hardline rhetoric on the nuclear standoff and against Israel has increasingly isolated Iran from the West, while his expansionist economic policies have also come under fire at home. Analysts are still hesitant to pick a winner, suggesting the vote may be a repeat of 2005 when a relatively unknown Ahmadinejad scored a stunning upset in a second-round runoff against heavyweight cleric Akbar Hashemi Rafsanjani. Passions have been running high during the campaign, with candidates hurling insults and allegations of lying and corruption at each other with unprecedented rancour on prime time television. At a final campaign rally on Wednesday, Ahmadinejad, who has frequently described the Holocaust as a myth, accused his rivals of using tactics like Hitler to whip up public opinion against him, the Fars news agency said. On the streets, supporters of the top candidates turned out en masse for carnival-like rallies in a country that has little to offer in terms of nightlife during three decades of conservative clerical rule. At nightfall, young people and families with children in tow would cruise around in cars festooned with pictures and campaign stickers, many wearing green for Mousavi and others waving the Iranian flag for Ahmadinejad. The two other candidates in the running are reformist former parliament speaker Mehdi Karroubi and ex-head of the elite Revolutionary Guards Corps, Mohsen Rezai. The mass rallies have reflected the glaring divide in Iran with towns and villages passionately backing Ahmadinejad, while young men and women in big cities throwing their weight behind Mousavi, the former premier. Mousavi, 67, has pledged to work to improve relations with the outside world, although there is doubt he will alter nuclear policy as all strategic decisions remain in the hands of supreme leader Ayatollah Ali Khamenei. In the television debates, Mousavi complained that Ahmadinejads foreign policy has undermined the dignity of Iran, and along with his fellow challengers, accused him of mismanaging the economy. Iran, OPECs second biggest oil exporter, is currently battling rampant inflation of 24 percent and a slump in earnings from crude oil as international prices have sunk from close to 147 dollars last year. But the incumbent too left no stone unturned in seeking to bolster his man-of-the-people image, accusing his rivals and their supporters of dishonesty and receiving financial privileges. He also took aim at Mousavis high-profile wife Zahra Rahnavard by questioning the academic qualifications of the former university chancellor and artist who has been an outspoken campaigner for womens rights. One thing is clear. Iran will never have television debates involving presidential candidates in the future. They just did not handle it with maturity, said one foreign diplomat based in Tehran. Ahmadinejads outbursts even prompted Rafsanjani to protest to the supreme leader warning him of social upheavals if the incumbent was not reined in. If the 52-year-old Ahmadinejad, a former Tehran mayor, is defeated, it will be the first time a sitting president is ousted after serving just a single four-year term. Polls open at 8:00 am (0330 GMT) and may remain until midnight depending on turnout among the 46 million-strong electorate, with Irans election chief Kamran Daneshjoo forecasting a record number of people at polling stations. The debates were effective and due to the transparency the candidates showed, it has created a platform for massive participation, said Mohammad Hossein, a government employee. A runoff will be held on June 19 if no single candidate emerges with 50 percent plus one vote on Friday. The campaign generally passed off peacefully across most of Iran, although the southeastern city of Zahedan was hit by unrest that saw 25 people killed in a Shiite mosque bombing, and another 10 in ensuing sectarian clashes.