William Hague says diplomatic base in Tehran to be restored as west looks to Iran to help tackle Isis-led insurgency in Iraq

William Hague has announced that the British embassy in Iran will be reopened as jihadist gains in northern Iraq have forced the west to reassess its relations with Tehran.

The foreign secretary said the circumstances were right to restore the diplomatic mission after a significant thawing in relations in recent months.

"Our two primary concerns when considering whether to reopen our embassy in Tehran have been assurance that our staff would be safe and secure, and confidence that they would be able to carry out their functions without hindrance," Hague told MPs in a written statement.

Hague's announcement came amid reports of clashes in the city of Baquba less than 40 miles north of Baghdad, the closest the fighting has come to the Iraqi capital since jihadists led by the Islamic State in Iraq and the Levant (Isis) took over most of the northern part of the country last week.

Insurgents took control of parts of Baquba overnight but were pushed back, army and police officers told Agence France-Presse. The attack took place in the centre of the capital of Diyala province and, according to the officers, militants temporarily occupied several neighbourhoods.

Fighting also took place in the village of Basheer, nine miles south of the city of Kirkuk in northern Iraq, where an attack by militants was repelled after an hour of clashes.

Isis fighters supported by disaffected Sunnis have swept through towns in the north but appeared to have halted their advance on Baghdad. The swift advance has faced little opposition from US-trained Iraqi forces, triggering fears that extremists will end up controlling a swath of territory from eastern Syria to northern Iraq.

The prospect of Iraq breaking up has forced the US and Britain to look to Iran. Hague said on Tuesday that the circumstances were right to reopen the British embassy in Tehran once "a range of practical issues" had been resolved. The embassy closed in 2011 after being ransacked by a mob protesting against sanctions.

"There has never been any doubt in my mind that we should have an embassy in Tehran if the circumstances allowed," he said. "Iran is an important country in a volatile region, and maintaining embassies around the world, even under difficult conditions, is a central pillar of the UK's global diplomatic approach. I have therefore now decided the circumstances are right to reopen our embassy in Tehran."

However, Hague has said there is no prospect of a British military intervention in Iraq, although counter-terrorism support could be offered. A Ministry of Defence (MoD) team has been sent to Iraq to assist embassy staff in contingency planning.

The rapprochement has been in the making for months following the Iranian elections and the new regime's more conciliatory approach to its civil nuclear programme, but it has been given an urgent push by the need to involve Iran in preventing Sunni extremists from capturing power in Iraq.

The foreign secretary said the UK would continue to "press for a wider change in the foreign policy of Iran", which he said played a divisive role in the region.

But he also told MPs it was important to discuss the crisis in Iraq in the light of the surge of Islamist violence there. "Iran does have the capability to play a more positive role across the region," he said at Foreign Office questions.

Hague is hoping the Iranians will press their fellow Shias in the Maliki regime in Baghdad to take a more conciliatory approach to forming a government.

Ministers insist the decision is not simply born of a panic-led recognition that the Isis movement represents a big threat to stability in the region, but is also a response to the change of mood in Tehran.

A small diplomatic team led by a charge d'affaires will be present in the country, with an ambassador sent later if progress is made.

In Vienna, US officials held brief discussions about Iraq with their Iranian counterparts at a meeting about Tehran's nuclear programme. But American officials have been quick to dismiss reports of military collaboration with a country the former US president George W Bush once described as part of the "axis of evil".

In a letter to Congress, President Barack Obama said 275 military personnel were being sent to Iraq to protect US citizens and the embassy in Baghdad, and would remain there until the security situation improved.

A White House statement said their main role would be to help embassy staff to relocate to US consulates in the cities of Basra in the south and Irbil in the north, and provide airfield management and security.

Obama has ruled out sending in ground troops to fight alongside Iraqi government forces, but drone strikes remain a possibility. The aircraft carrier USS George HW Bush has been deployed to the Gulf, accompanied by two more warships.

Separately, US officials said the White House was considering sending a contingent of special forces soldiers to Iraq. Their limited mission – not yet approved – would focus on training and advising Iraqi troops, many of whom have fled their posts in the face of the jihadist advance.

As Obama weighs up his options on how to prop up the Shia-led government of the Iraqi prime minister, Nouri al-Maliki, Iran is already deepening its involvement in Iraq. Qassem Suleimani, commander of Iran's Quds force, is in Baghdad providing advice on how to deal with Isis and the Sunni insurgency. Iraqi security officials said the US had been notified in advance of the visit by Suleimani, whose forces are a branch of Iran's Revolutionary Guards which in the past has organised Shia militias to target US troops in Iraq and, more recently, has helped the Syrian president, Bashar al-Assad, against Sunni rebels in Syria's civil war.

Zuhair al-Nahar, a spokesman for the Iraqi prime minister, appealed for help from the US and Britain. "The government and the armed forces and the volunteers have stopped any advance of the Isis terrorists," he said in an interview with the BBC. "The Iraqi air force is carrying out continuous sorties and attacks on convoys and strategic areas of the terrorists. However, Iraq needs all the support it can get. Iraq has asked the US for air strikes to be conducted. Iraq would like support in counter-terrorism, intelligence activities and advice and training."

He also asked for assistance from the UK, calling for help with "intelligence capabilities, training capabilities, pressure – political pressure on countries that are supporting this terrorist group that are a scourge on this whole area".