Iran has fired more than a dozen missiles targeting at least two airbases in Iraq which host U.S. and coalition military personnel, the Pentagon confirmed Tuesday evening, and warned the United States and its allies against retaliating.

The attacks occurred at approximately 5:30 p.m. ET — around midnight, local time — and targeted the bases at Ain Assad and Erbil, according to a Pentagon statement.

The Erbil base has hosted Canadian troops and other personnel who have been part of the U.S.-led coalition against ISIS.

Canada's chief of the defence staff, Gen. Jonathan Vance tweeted late Tuesday that all Canadian personnel are safe.

CAF families: I can assure you that all deployed CAF personnel are safe & accounted for following missile attacks in Iraq. We remain vigilant. —@CDS_Canada_CEMD Vance met with Defence Minister Harijit Sajjan earlier Tuesday and both were briefed by commanders on the ground in Iraq and in Ottawa.

Prime Minister Justin Trudeau "informed of the situation" and was monitoring it closely, a spokesperson told CBC News.

A member of the Canadian Forces mans a gun from inside a Canadian Griffon helicopter near Erbil air base in Northern Iraq. (Murray Brewster/CBC)

A U.S. official told The Associated Press there were very few, if any, casualties, but did not provide any further details. Iraq's military later said that there were no casualties among Iraqi forces.

The confirmation from U.S. officials follows reports on Iranian state TV that said Tehran launched "tens" of surface-to-surface missiles at the Ain Assad airbase in response to the killing of top Iranian military commander Qassem Soleimani.

Iranian state TV also quoted a Revolutionary Guards commander as saying Iran would not spare any American troops.

"The missile attacks today were just the first step. [U.S. President Donald Trump] should think about withdrawing its troops from the region and not to leave them within our reach."

Early Wednesday, Iran's foreign minister tweeted that the country "took and concluded proportional measures" but reiterated that it is not seeking war.

Iran took & concluded proportionate measures in self-defense under Article 51 of UN Charter targeting base from which cowardly armed attack against our citizens & senior officials were launched.<br><br>We do not seek escalation or war, but will defend ourselves against any aggression. —@JZarif

A White House spokesperson said earlier the president was aware of the attacks.

"The president has been briefed and is monitoring the situation closely and consulting with his national security team," said press secretary Stephanie Grisham.

He later tweeted that "all is well!"

All is well! Missiles launched from Iran at two military bases located in Iraq. Assessment of casualties & damages taking place now. So far, so good! We have the most powerful and well equipped military anywhere in the world, by far! I will be making a statement tomorrow morning. —@realDonaldTrump

Vice-President Mike Pence briefed top Democrats in Congress on the attacks via telephone Tuesday evening. Pence's spokesperson, Katie Waldman, said he is in continuous contact with congressional leadership and national security officials at Trump's direction.

U.S. Secretary of State Mike Pompeo and Defence Secretary Mark Esper both arrived at the White House late Tuesday following the attacks.

House Speaker Nancy Pelosi tweeted that she is "closely monitoring" the situation.

Closely monitoring the situation following bombings targeting U.S. troops in Iraq. We must ensure the safety of our servicemembers, including ending needless provocations from the Administration and demanding that Iran cease its violence. America & world cannot afford war. —@SpeakerPelosi

Democratic presidential hopeful and former vice-president Joe Biden tweeted that he would not comment on the attacks Tuesday evening, but said that he and his wife, Jill, "are keeping our troops and Americans overseas in our prayers. We hope you'll keep them in yours."

Late Tuesday, the U.S. Federal Aviation Administration barred commercial flights over the Persian Gulf and the Gulf of Oman "due to heightened military activities."

Some Canadian troops moved

The sprawling coalition base at Erbil was home to Canadian operations in the battle against ISIS and has been the principal base that Canadian special forces have used to operate, and likely continues to serve that function. A field hospital that was operating there has been removed.

Some Canadian troops have been moved to Kuwait in light of the security situation on the ground, according to a letter released by Vance on Tuesday, and it remains unclear how many Canadian troops are still at the base.

U.S. President Donald Trump delivers remarks to troops in an unannounced visit to Ain Assad airbase, Iraq, on Dec. 26, 2018. (Jonathan Ernst/Reuters)

A Canadian tactical aviation detachment of Griffon helicopters also operated out of the base.

The 115 German soldiers stationed at the Erbil base were fine after the attack, a spokesperson for the German armed forces said.

The Pentagon statement said the bases have been on "high alert due to indications that the Iranian regime planned to attack our forces and interests in the region.

"As we evaluate the situation and our response, we will take all necessary measures to protect and defend U.S. personnel, partners and allies in the region," the statement said.

Iranian state TV said the name of the operation was Martyr Soleimani. It said the aerospace division of Iran's Revolutionary Guard, which controls the country's missile program, launched the attack.

The Revolutionary Guard has already warned the U.S. and its regional allies against retaliating in a statement carried by Iran's state-run IRNA news agency.

"We are warning all American allies, who gave their bases to its terrorist army, that any territory that is the starting point of aggressive acts against Iran will be targeted," the statement said.

It also threatened Israel.

Ain Assad airbase is located in Iraq's western Anbar province. It was first used by American forces after the 2003 U.S.-led invasion that toppled dictator Saddam Hussein. American troops were later stationed there amid the fight against ISIS militants in Iraq and Syria. It houses about 1,500 U.S. and coalition forces.

Pence visited the base last November, and Trump was there in December 2018.

U.S. Vice-President Mike Pence delivers remarks to U.S. troops at Ain Assad airbase in Iraq on Nov. 23, 2019. (Jonathan Ernst/Reuters)

About 70 Norwegian troops were on the airbase at the time of the missile attack, but no injuries have been reported, Brynjar Stordal, a spokesperson for the Norwegian Armed Forces, told The Associated Press in a phone interview.

New Zealand's 50 military personnel in Iraq were also safe, according to acting prime minister Winston Peters, as were Australia's 300 defence personnel, said Prime Minister Scott Morrison.

The attack came mere hours after crowds in Iran mourned Soleimani and as the U.S. continued to reinforce its own positions in the region. U.S. embassies and consulates in Asia, Africa and Europe issued security alerts for Americans.

WATCH: Canada's former head of mission to Iran offers his analysis on the Iran strikes

Dennis Horak, Canada's former head of mission to Iran, says Tehran's decision to fire missiles directly from its own territory and not from a proxy group could signal an escalation in the conflict with the United States and its coalition partners. 10:47