BEIRUT, Lebanon—Iran deployed Revolutionary Guard forces to fight in Iraq, helping government troops there wrest back control of most of the city of Tikrit from militants, Iranian security sources said.Two battalions of the Quds Forces, the overseas branch of Iran’s Revolutionary Guard Corps that has long operated in Iraq, came to the aid of the besieged, Shiite-dominated government of Prime Minister Nouri al-Maliki, they said.

Combined Iraqi-Iranian forces retook control of 85% of Tikrit, the birthplace of former dictator Saddam Hussein, according to Iraqi and Iranian security sources.

They were helping guard the capital Baghdad and the two Shiite holy cities of Najaf and Karbala, which have been threatened by the Islamic State of Iraq and al-Sham, an al Qaeda offshoot. The Sunni militant group’s lightning offensive has thrown Iraq into its worse turmoil since the sectarian fighting that followed the 2003 U.S.-led invasion.

Shiite Iran has also positioned troops along its border with Iraq and promised to bomb rebel forces if they come within 100 kilometers, or 62 miles, of Iran’s border, according to an Iranian army general.

In addition, Iran was considering the transfer to Iraq of Iranian troops fighting for the regime in Syria if the initial deployments fail to turn the tide of battle in favor of Mr. Maliki’s government.

The Iraqi government has signaled to the U.S. it would allow airstrikes against insurgents and asked Washington to speed the delivery of promised weapons.

That raises the prospect of both the U.S. and Iran lending support to Mr. Maliki against ISIS insurgents, who are seeking to create a caliphate encompassing Iraqi and Syrian territory.

Gen. Qasem Sulaimani, the commander of the Quds Forces and one of the region’s most powerful military figures, traveled to Baghdad this week to help manage the swelling crisis, said a member of the Revolutionary Guards, or IRGC.

Qassimm al-Araji, an Iraqi Shiite lawmaker who heads the Badr Brigade bloc in parliament, posted a picture with Mr. Sulaimani holding hands in a room in Baghdad on his social-networking site with the caption, “Haj Qasem is here,” Iranian news sites affiliated with the IRGC reported on Wednesday. “Haj Qasem” is Mr. Sulaimani’s nom de guerre.

At stake for Iran in the current tumult in Iraq isn’t only the survival of an Shiite political ally in Baghdad, but the safety of Karbala and Najaf, which along with Mecca and Medina are considered sacred to Shiites world-wide.

An ISIS spokesman, Abu Mohamad al-Adnani, urged the group’s Sunni fighters to march toward the “filth-ridden” Karbala and “the city of polytheism” Najaf, where they would “settle their differences” with Mr. Maliki.

That coarsely worded threat further vindicates Iran’s view that the fight unfolding in Iraq is an existential sectarian battle between the two rival sects of Islam-Sunni and Shiite—and by default a proxy battle between their patrons Saudi Arabia and Iran.

“Until now we haven’t received any requests for help from Iraq. Iraq’s army is certainly capable in handling this,” Iran’s Foreign Ministry spokeswoman Marzieh Afgham said Wednesday.

Despite those assuring comments, measures by the Iranian government in the past day indicated that an air of crisis had enveloped Tehran. Iran’s army and border guards have been placed under full alert along the country’s long border with Iraq, Iranian media reported.

Iran’s President Hasan Rouhani cut short a religious celebration on Thursday and said he had to attend an emergency meeting of the country’s National Security Council about events in Iraq.

“We, as the Islamic Republic of Iran, will not tolerate this violence and terrorism….We will fight and battle violence and extremism and terrorism in the region and the world,” he said in a speech.

Iran’s chief of police, Esmail Ahmadi-Moghaddam, said the National Security Council would consider intervening in Iraq to “protect Shiite shrines and cities.”

ISIS’s rapid territorial gains in the past few days appeared to have caught Iranian officials by surprise and opened a debate within the regime over whether Iran should publicly enter the battle, citing the country’s strategic interest and ideological responsibility. Iranian officials also privately expressed concern about whether Mr. Maliki was capable of handling the turmoil.

“The more insecure and isolated Maliki becomes, the more he will need Iran. The growth of ISIS presents a serious threat to Iran. So it would not be surprising to see the Guards become more involved in Iraq,” said Alireza Nader, a senior policy analyst at the Rand Corp.

Quds Forces have been active in Iraq since shortly after the U.S.-led invasion in 2003 and have helped create, train and fund Shiite militias that fought U.S. military forces. Their reach and influence extends from Iraq to Lebanon, Syria and the Palestinian territories.

The two IRGC battalions moved to Iraq on Wednesday were shifted from the Iranian border provinces of Urumieh and Lorestan. Their task is to help secure the holy Shiite cities of Karbala and Najaf and tighten security around Baghdad, according to IRGC members in Iran.

Revolutionary Guards units that serve in Iran’s border provinces are the most experienced fighters in guerrilla warfare because of separatist ethnic uprisings in those regions. IRGC commanders dispatched to Syria also often hail from those provinces.

Write to Farnaz Fassihi at [email protected]