Iran has confirmed for the first time that forces from its revolutionary guards corps (IRGC) are in Syria helping Bashar al-Assad's government crush rebels, and warned that it would get involved militarily if its Arab ally came under attack.

In a clear public signal of Tehran's continuing support for Assad, the commander of the Islamic republic's elite military formation said that a number of members of the IRGC's Qods force were in Syria, though General Mohammad Ali Jafari gave no further details and claimed this did not constitute "a military presence".

It was a surprisingly candid response to persistent claims by western countries, the Syrian opposition and Israel that Iran is actively helping the regime in the 18th month of a bloody war. Lakhdar Brahimi, the veteran Algerian diplomat who replaced Kofi Annan as UN envoy to Syria earlier this month, met Assad in Damascus on Saturday but warned afterwards that any progress would be slow and halting given the yawning gap between government and opposition. "The crisis is dangerous and getting worse, and it is a threat to the Syrian people, the region and the world," said Brahimi.

Reports from Syriaon Sunday described government forces fighting rebels amid shelling and sniper fire in Damascus and Aleppo, as well as in Homs and Deir ez-Zor. The Local Coordination Committees, an activist network, reported 103 dead. Opposition activists reported 115 people killed on Saturday. According to the UN around 20,000 people have been killed. Opposition sources say the figure is closer to 30,000.

Jafari's admission underlines the way in which the Syrian uprising has become enmeshed in regional and international rivalries. Saudi Arabia, Qatar and Turkey are arming Syrian rebel groups, while the US, Britain and France have called for Assad to go but are offering only limited and non-lethal backing to the armed opposition. Russia and China have repeatedly blocked action against Syria at the UN.

The Qods force includes elements of special forces, intelligence gathering and aid, and answers to Iran's supreme leader, Ayatollah Ali Khamenei. It has been accused of planning attacks inside Iraq since the overthrow of Saddam Hussein. Jafari said that the IRGC was providing "intellectual and advisory help" to Syria.

British officials say that the IRGC has provided riot control equipment and technical advice on how to crush dissent, for example on how to flood areas with security forces. Iran is also providing support to improve the Syrian regime's intelligence gathering capabilities and help to monitor protesters' use of the internet and mobile phone network, including text messaging.

Iran is said to have been dismayed at the heavy-handed way its long-standing Arab ally responded when the unrest began in March 2011, contrasting it with the more sophisticated response to protests that followed its own disputed presidential election in 2009.

"If Syria came under military attack, Iran would also give military support but it … totally depends on the circumstances," AFP reported Jafari as saying at a rare press conference in Tehran.

The general also said that the Strait of Hormuz, the channel at the mouth of the Gulf through which a third of the world's traded oil passes, would be a legitimate target for Iran should it be attacked. "If war occurs in the region and the Islamic republic is involved, it is natural that the Strait of Hormuz as well as the energy [market] will face difficulties. The US has many vulnerabilities around Iran, and its bases are within the range of the guards' missiles. We have other capabilities as well, particularly when it comes to the support of Muslims for the Islamic republic," he said.

In Damascus, Brahimi also met Syrian opposition figureswho are still tolerated by the regime. "We told Mr Brahimi … of our support for his efforts to resolve the crisis by ending the violence and killings, providing medical care and releasing political prisoners," said Hassan Abdel Azim, spokesman for the National Coordination Committee for Democratic Change. But the head of the Free Syrian Army's military council in Aleppo, Colonel Abdel Jabar al-Oqaidi, predicted that the envoy's mission would fail, like Annan's, because he had nothing to offer those fighting for their freedom, al-Arabiya TV reported.

Syria's state news agency Sana quoted Assad as telling Brahimi that the success of his mission hinged on "pressuring countries which finance and train the terrorists, and which traffic weapons to Syria, to stop these actions."

In Istanbul, Tariq al-Hashimi, the fugitive Iraqi vice-president, said in interview that the government of Prime Minister Nuri al-Maliki was failing to stop ammunitions and armaments reaching Syrian government forces. "My country is unfortunately becoming an Iranian corridor to support the autocratic regime of Bashar al-Assad," he said. "There is no doubt about that."