Baghdad, Iraq (CNN) They answered the call by the thousands, some walking miles in sweltering heat to volunteer to fight an al Qaeda splinter group barreling towards the Iraqi capital.

With reports that fighters with the Islamic State in Iraq and Syria, the terror group also known as ISIS, was some 40 miles from the gates of Baghdad, the country's top religious and political leaders appealed for able-bodied men of fighting age to volunteer to defend the country.

"Mosul, Tal Afar, Falluja, wherever, by God's will we will be ready to defend any location," said 23-year-old Ahmed, who showed up Thursday at a recruiting station in central Baghdad, one of dozens that have popped up across the country in recent days to handle the influx of volunteers.

Ahmed, who gave only his first name, was joined by hundreds of men, mostly Shiites in their 20s, at the Muthanna Airbase, where they waited under a makeshift canopy for their chance to sign up.

"What's happening is sabotage. Those terrorists must be driven out, and by God's will they will be driven out," he said.

ISIS' lightning advance in Iraq has been aided by support from many Sunnis who say they have been pushed aside and marginalized by Prime Minister Nuri al-Maliki and his Shiite-dominated government, a divide that threatens to tear the country apart.

ISIS, aided by Sunni fighters, seized Iraq's second-largest city, Mosul, and then threatened to march on Baghdad.

The militants' rapid advance -- and the total collapse of Iraq's security forces in the face of their assault in Mosul and a number of other smaller cities and towns -- have rocked al-Maliki's government.

While the aim of ISIS is to establish an Islamic state that stretches from Iraq to northern Syria, where it has had significant success in battling Syrian President Bashar al-Assad's forces, it has made al-Maliki's removal from power part of its campaign.

Last week, as ISIS fighters neared Samarra, home to a revered Shiite shrine, al-Maliki took to the airwaves to call on volunteers to protect the city north of Baghdad.

That was followed by Iraq's top cleric, Grand Ayatollah Ali al-Sistani, appeal to people to join the military to protect Shiite shrines, a call that saw a massive outpouring of Shiite volunteers that raised concerns about the possible widening of the sectarian conflict.

During Friday prayers, a sermon delivered by a senior cleric and representative of al-Sistani called for all Muslim sects to stand together in the fight against ISIS.

"Last week, the higher religious authority called upon Iraqis to volunteer to join the armed forces to defend Iraq in these difficult conditions," Imam Sayid Ahmed al-Safi said during prayers in the Shiite holy city of Karbala.

"This call was directed to everybody and not to one sect, it aimed to prepare to stand up to ISIS that has got the upper hand and strongest presence in many areas and that has declared that it is targeting other provinces including the holy Najaf and Karbala and other places within its reach like holy places and shrines of holy people and imams of all religions."

Despite the widespread call, the volunteers signing up at the Muthanna Airbase were predominantly Shiite.

"I volunteered to preserve the people, and as a response to request of Ayatollah Sistani," Saif Saad, 25, said. "We are here to serve the people, and get rid of ISIS."

Every so often, an officer ticked off the names of 10 men on a list. Each group headed into a beige, cramped building where they were give a cursory medical screening, including eye and dental exams.

"They will call or text us, and then we will put on uniforms and go to the front line," Saad said.

The volunteers, who have been told they will receive a salary commiserate with soldiers in the Iraqi military, will get some training.

It depends, Gen. Fadhil Abdul Sahib said, on the "tactical situation."

"Maybe a few days, maybe a month," he said.

With his medical exam completed, now Saad must wait.

He says he's not worried. "We are here with ... courage because we are here to drive out terrorism from this country."