Media playback is unsupported on your device Media caption Is 2020's Iran crisis already over?

The US says it is "ready to engage without preconditions in serious negotiations" with Iran following the countries' exchange of hostilities.

In a letter to the UN, the US justified the killing of Iranian General Qasem Soleimani as an act of self-defence.

Iran retaliated by firing missiles at airbases housing US forces in Iraq, causing no casualties. It also told the UN it was an act of self-defence.

Gen Soleimani was widely regarded as Iran's second most powerful man.

As head of the Revolutionary Guards' elite Quds Force, he was an architect of Iranian policy in the Middle East.

Iran's Supreme Leader Ali Khamenei described the missile attacks as a "slap in the face" for the US, and called for an end to the American presence in the region.

On Thursday the Revolutionary Guards' aerospace commander, Amir Ali Hajizadeh, said the missile strikes were the beginning of an operation that would continue.

They had not been intended kill US troops, state TV quoted him as saying, but instead were aimed at damaging US military operations.

Tehran had "used cyber-attacks to disable US plane and drone navigation systems" during the missile strikes, he said.

What do the letters say?

In a letter to the UN Security Council, US ambassador to the UN Kelly Craft said the US was ready to negotiate "with the goal of preventing further endangerment of international peace and security or escalation by the Iranian regime".

The killing of Soleimani was justified, the letter argued, under Article 51 of the UN Charter, which requires states to "immediately report" to the Security Council any measures taken in exercising the right of self-defence.

Media playback is unsupported on your device Media caption "Iran appears to be standing down" - Trump delivers a statement at the White House

The US would take additional action "as necessary" in the Middle East to protect its personnel and interests, the letter added.

But Iran's UN ambassador Majid Takht Ravanchi said the US offer of talks was "unbelievable" while the US continued to enforce harsh economic sanctions against Iran.

US President Donald Trump has previously offered to hold talks with Iran without preconditions - and to meet President Hassan Rouhani. In September, Ayatollah Khamenei said Iran would never engage in bilateral talks, saying it was part of America's policy "to put pressure on Iran".

Ayatollah Khamenei said that if the US rejoined a landmark nuclear deal it withdrew from in 2018, it could take part in multilateral talks with Iran and the other parties to the deal.

Image copyright Getty Images Image caption Qasem Soleimani was considered the second most powerful man in Iran before his death

Iran also cited Article 51 as justification for its attack on US bases.

In the Iranian letter, Mr Ravanchi wrote that Tehran "does not seek escalation or war" after exercising its right to self-defence by taking a "measured and proportionate military response targeting an American airbase in Iraq".

What did Trump say about the Iranian strikes?

Mr Trump has previously threatened military action against Iran if it were to target US personnel and bases, but the US president did not announce any military action, saying Iran's attack had caused no casualties.

"No Americans were harmed in last night's attack by the Iranian regime," he said.

"Iran appears to be standing down, which is a good thing for all parties concerned," he added.

Media playback is unsupported on your device Media caption "I believe we are safer today" - US Vice-President Mike Pence

The US House of Representatives is expected to vote on Thursday on a resolution to force Mr Trump to halt further military action against Iran unless Congress gives it the all-clear.

"Members of Congress have serious, urgent concerns about the administration's decision to engage in hostilities against Iran and about its lack of strategy moving forward," Nancy Pelosi, Speaker of the House, said in a statement.

What happened in the missile attacks?

It was the most direct assault by Iran on the US since the seizing of the US embassy in Tehran in 1979.

A total of 16 missiles were launched from at least three sites in Iran at about 02:00 local time on Wednesday (22:30 GMT on Tuesday), Defence Secretary Mark Esper said.

At least 11 of them struck the air base in Al Asad, west of Baghdad, and at least one more hit the Irbil base, he said. Several other missiles landed at some distance from the targets.

US Joint Chiefs of Staff Chairman Mark Milley said he believed early warning systems had prevented casualties.

"[What] I believe, based on what I saw and what I know, is that they were intended to cause structural damage, destroy vehicles and equipment and aircraft, and to kill personnel," he said.

How did we get here?

Tensions between Tehran and Washington began rising in 2018 after President Trump pulled the US out of a landmark nuclear deal between Iran and world powers. The accord was intended to curb Iran's nuclear programme and prevent it from acquiring nuclear weapons.

Mr Trump wanted a new deal that would also curb Iran's ballistic missile programme and its involvement in regional conflicts.

The US also re-imposed sanctions on Iran, sending its economy into freefall.

Soleimani's assassination on 3 January followed a sharp escalation between the US, Iran and Iran-backed groups in Iraq sparked by the death of a US military contractor in a missile attack on a US base - for which the US held Iran responsible.

The US responded with air strikes against the Iran-backed militia Kataib Hezbollah. Militia supporters then attacked the US embassy in Baghdad.

Soleimani was regarded as a terrorist by the US government, which says he was responsible for the deaths of hundreds of American troops and was plotting "imminent" attacks. The US has not provided evidence of this.

Media playback is unsupported on your device Media caption Feeling the squeeze: Iran sanctions explained

Iran vowed "severe revenge" for his death. Millions of Iranians turned out for the commander's funeral, with mourners chanting "death to America" and "death to Trump".

A stampede at the funeral in Soleimani's hometown, Kerman, killed 50 people and injured 200 more on Tuesday.

The US strike on Soleimani also killed members of Iran-backed Iraqi militias, who have also vowed revenge.

However, US Vice-President Mike Pence told CBS News that "intelligence" indicated that Iran had asked its allied militias not to attack US targets.