SANAA, Yemen -- Masked militants set off a large car bomb outside a security headquarters in Yemen's southern port city of Aden early Sunday killing at least five soldiers before storming the compound, officials said.

Speaking on condition of anonymity because they were not authorized to brief reporters, the security officials said the militants placed snipers on the roof and gunned down most of the security forces inside. The officials gave conflicting accounts of what happened next inside the building. They initially said that the militants had taken an unknown number of people hostage. Later they said that they opened cell gates and released prisoners.

Witnesses said at least four militant snipers could be seen on the roof of the compound. They also described mayhem as dead bodies littering the compound's front courtyard couldn't be retrieved because of the continuous sniper fire. Shallal al-Shayae, the security chief, was not inside the compound at the time of the attack, the officials said.

Get Breaking News Delivered to Your Inbox

In an online statement, the local affiliate of the Islamic State of Iraq and Syria (ISIS) claimed responsibility for the attack, saying they killed 50 soldiers and identified the bomber as Abu Othman al-Hadrami.

A Saudi-led coalition meanwhile launched a wave of airstrikes -- starting overnight and continuing until noon the next day -- on the rebel-held capital, Sanaa, apparently in response to a ballistic missile fired by the rebels toward an international airport on the outskirts of Riyadh, the Saudi capital. Saudi Arabia said it shot down the missile before it hit its target, with fragments landing in an uninhabited area north of the capital.

A Houthi fighter talks on the phone as he walks at the site of an air strike on a parade square in Sanaa, Yemen November 5, 2017. KHALED ABDULLAH/REUTERS

U.S. President Donald Trump was quick to blame Iran. "A shot was just taken by Iran, in my opinion, at Saudi Arabia. And our system knocked it down," Mr. Trump said, referring to the Patriot missile batteries Saudi Arabia purchased from the U.S.

Iran's Defense Minister Gen. Amir Hatami has denied his country was involved in the incident. "Does anyone ask the United States what are you giving to Saudi Arabia?" he was quoted by the semi-official ISNA news agency as saying.

Iran's powerful Revolutionary Guard Chief, Maj. Gen. Mohammad Ali Jafari, also said that Iran can't transfer rockets to Yemen and stressed that the missiles were made there. He described Mr. Trump's comments as "lies."

Yemen is embroiled in a war between Iran-backed Shiite rebels, known as Houthis, and the internationally recognized government, which is allied with a Saudi-led military coalition. The government has been based in Saudi Arabia since the Houthis overran the capital Sanaa in 2014. Government forces ostensibly control Aden, but the city remains volatile.

The Houthis said in a statement that the missile was launched in response to bombings that have killed civilians. The Houthis have fired a number of missiles across the border in recent years, but this appeared to be the deepest strike yet within Saudi territory.

Riyadh is around 620 miles north of the border with Yemen.

Saudi-led airstrikes in Yemen have killed and wounded thousands of civilians, hitting houses, busy markets, hospitals and schools in what rights groups have said amounts to war crimes. Houthi artillery has also killed a large numbers of civilians. The war has claimed more than 10,000 lives and driven the Arab world's poorest country to the brink of famine.