TEHRAN -- Inside a massive mosque Tuesday evening, more than 15,000 conservative Iranians chanted a mocking farewell to Iran’s reformist president.

"Bye bye, Rouhani," roared the crowd. "At the end of the week, Rouhani is gone."

Supporters of hardline candidate Ebrahim Raisi have rising hopes he will unseat incumbent President Hassan Rouhani in Friday’s election, now that Raisi’s chief conservative rival, Tehran mayor Mohammad Ghalibaf, has dropped out and thrown his support to Raisi.

At Tuesday’s rally for Raisi, the last before what is expected to be a tight election, the packed crowd erupted when Ghalibaf joined Raisi onstage and the two men clasped hands and held them high. Turnout was so heavy that the overflow could only watch the moment on a huge screen outside.

Iranian presidential candidate Ebrahim Raisi (C) greets his supporters as he stands with former presidential candidate and mayor of Tehran, Mohammad Bagher Ghalibaf (C-R), during a campaign rally at Imam Khomeini Mosque in the capital Tehran on May 16, 2017. Atta Kenare / AFP - Getty Images

It’s fair to assume that Raisi will collect most of the votes that were going to go to Ghalibaf, bringing him closer to victory. But other minor candidates are dropping out and throwing their support to Rouhani.

Four years ago, Rouhani managed to unite disparate factions and win his first term as president. A centrist and reformer, he tallied more than 50 percent in the first round in 2013 against five other candidates, meaning no run off was needed. His administration negotiated a 2015 nuclear deal with the U.S. and other world powers that eased sanctions that had thwarted the economy.

Related: Rouhani: I Won't Allow Trump To 'Tear Up' Nuclear Deal

But this time, with the economy still stagnant, polls show Rouhani struggling to reach 50 percent.

At rallies and during televised debates over the past few weeks, Rouhani, Raisi, and Ghalibaf, before he dropped out, traded bitter barbs. Both Raisi and Ghalibaf have accused Rouhani of not delivering on the promises he made when his administration signed the nuclear deal with the U.S. and other major powers. The majority of Iranians, they argue, have not felt the economic benefits Rouhani promised, likening the deal to a check that cannot be cashed.

For his part, Rouhani has gone on the offensive as his numbers have slipped, trying to appeal to the large youthful vote, attacking hardliners for not giving people social freedoms, for isolating Iran and putting it on a trajectory towards war.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Rouhani has alleged that the Revolutionary Guard, which supports Raisi, has deliberately tried to undermine the nuclear deal. The Iranian president cited recent testing of ballistic missiles with incendiary anti-Israeli slogans emblazoned on them. Rouhani also has claimed that if the hardliners get back into power the country will have a suffocating security atmosphere.

Related: Why Scrapping Nuclear Deal May Embolden Iran's Hardliners: Analysis

At a rally Monday, Rouhani told his supporters, "If you vote for me in large numbers I will go and kiss the Supreme Leader’s hands 10 times if necessary in order to free political prisoners."

Rouhani was saying he would kiss Ayatollah Ali Khamanei’s hands in order to free Mir Hossain Mousavi, the reformist candidate who lost the disputed 2009 election. Allegations that the election was rigged in favor of then-president Mahmoud Ahmadinejad prompted protests that turned violent and led to a crackdown by the hardline government. Ever since, Mousavi has been under house arrest and banned from politics.

Supporters of Iranian current president and presidential candidate Hassan Rouhani cheer in front of a huge election banner depicting him as they hold his pictures during an election campaign rally in Tehran, Iran on May 13, 2017. Abedin Taherkenareh / EPA

While Raisi supporters chant goodbye to Rouhani, Rouhani’s supporters have invoked Mousavi. At several recent rallies, they have burst into cheers of "Ya Hossein, Ya Hossein," in support of Mousavi, and in what could be seen as defiance of the Supreme Leader and the Revolutionary Guard.

Many at a Rouhani rally last week, where the crowd skewed young and cosmopolitan, said they were there to take a stand. Nineteen-year-old journalism student Layla Daryafarghi was 11 during the 2009 crackdown. She said she came to the Rouhani rally because she wants to speak out for freedom and also to support Mousavi, and to support Mohammad Khatami, the reformer who was president of Iran from 1997 to 2005.

"We all want to show that we want to have freedom. We want to say to all the world, we love our country and we want it to be free," said Daryafarghi. "For me it’s for Mr. Khatami and for Mr. Mousavi, but I think that all of [us] think [Rouhani] is going to do something different. Four years was not enough for the things he said he wanted to do. He wants more time to show us he can do anything."

Supporters of Iranian current president and presidential candidate Hassan Rouhani flash victory sign as hold his pictures during an election camping rally in Tehran, Iran on May 9, 2017. Abedin Taherkenareh / EPA

At Raisi’s rallies, the crowd is older and less upscale. Raisi, a prominent cleric who has the backing of many religious leaders, has made security and trust in government key issues. That appeals to Maryam Jamali, a supporter at a Raisi rally last week. Draped in a black chador, the full-length dress favored by observant women, Jamali said that Raisi is the only candidate who can confront the corruption that has spread through the country, that he is an honest man.

Sobhan Shakeri, a 24-year-old Hezbollah supporter studying to be a cleric, said he had come to the rally because Raisi "follows in the footsteps" of Ayatollah Ali Khamenei and Hezbollah.

"Whoever listens to the leader and obeys him has the support of us, the Hezbollah. Anyone who does not obey him we will turn our backs on them."

Others at the rally said they supported Raisi because he "follows the line" of the theocratic Iranian Revolution, and because he cares for the poorer segments of society that they feel have been forgotten under Rouhani.

Without official polls, it is hard to make predictions in Iranian elections, but from information available via social media and state media, experts here believe it will be a close race.

Before Ghalibaf dropped out, Foad Izadi, an associate professor of American studies at the University of Tehran, said the election was likely to go to a run-off because Rouhani was probably "well below" 50 percent. Izadi said he was using unofficial, unpublished numbers collected by a colleague at the university.

Said Izadi last week, "The polls show him at about 36 or 37 percent. There are about 18 percent undecided, but they will not all go to him. That type of number just a week before an election doesn’t look very good for a first round win."

Izadi also noted, however, that "traditionally, historically, we have two-term presidents."

Both Raisi and Rouhani have benefited as all the minor candidates have dropped out and the election has become a two-man race down the final stretch.

Rouhani may have received a boost from the third and last debate of the presidential campaign last Friday. He attacked hardliners, and many observers felt he outperformed his rivals.

Iranian observers think the smart money is still on Rouhani. But he also has to best another opponent in Friday’s balloting: low turnout. In Iran, higher turnout favors moderates and reformers.