Gunmen raided the Intercontinental Hotel in Kabul killing at least 18 people during a 12-hour standoff with security forces that ended Sunday, Afghan authorities said.

Of those killed, 14 were foreign nationals and four were Afghans, according to Najib Danish, spokesman for the Ministry of Interior.

Four gunmen were also killed by Afghan security forces responding to the attack, he said.

Nasrat Rahimi, a deputy spokesman for the Interior Ministry, had said earlier that foreigners were among the dead, but did not provide details on the nationalities of the victims. Seven Afghans were wounded, he said.

Afghan security forces went on every floor of the six-story hotel in a clearing operation, said Danish.

He said four attackers were involved, but the Taliban released a statement claiming responsibility and saying it was carried out by five assailants.

The attackers were affiliated with the Pakistan-based Haqqani network, according to the Interior Ministry.

The ministry said that 153 people — including 41 foreigners — were rescued from the hotel.

After the Interior Ministry declared the siege over, TOLO news channel reported that two attackers were still inside the hotel and gunshots were still ringing.

Gunmen attacked the hotel about 9 p.m. Saturday (11:30 a.m. ET) and were still trading fire with Afghan special forces Sunday morning local time, the station reported.

Ambulances raced to the scene during a lull in the shooting, a witness who lives near the hotel told CNN.

Guests try to escape

During the standoff, the hotel’s third floor, where the kitchen is located, caught fire, Rahimi said. Lotfullah Najafizada, the head of TOLO, tweeted that the last attacker was on the hotel’s top floor.

TOLO showed images of people apparently hanging off balconies, saying they were “desperate guests and staff trying to escape” from the burning hotel.

The attackers had been in the kitchen, then moved to the fourth floor, an Afghan special forces commander told CNN.

Haqqani network

The US State Department had warned last week of a possible attack by extremist groups targeting Kabul hotels.

The Afghan Interior Ministry blamed the Haqqani network for the attack. The group based in the Pakistani tribal area of Waziristan, and known for its high-profile attacks on Western targets in Afghanistan.

The network maintains close ties to al Qaeda and the Taliban, and seeks to reestablish Taliban rule in Afghanistan.

In 2001, then-US Ambassador Ryan Crocker accused the Haqqani network of a daylong attack against the US Embassy in Kabul.

This month, President Donald Trump announced that his administration would suspend aid to Pakistan until the country took more assertive steps to rein in terror organizations, referring to the Haqqani network by name.

Pakistan’s ministry of foreign affairs issued a statement condemning the attack on the Intercontinental in Kabul.

“We reiterate our strong condemnation of terrorism in all its forms and manifestations. In our view, cooperation among the states is important for effectively combating and eliminating the scourge of terrorism,” it said in a statement.

US Ambassador John R. Bass also condemned the attack and commended the security forces’ quick response.

“Such violence has no place here or anywhere in the world,” Bass said.

“Afghanistan deserves peace and security — not deliberate and murderous attacks on innocent civilians,” he said in a statement.

The British ambassador to Afghanistan, Nicholas Kay, also tweeted his condolences, saluting the bravery of the Afghan security forces.

“When it’s over, Kabul will show its resilience again,” Kay said.

Hotel was attacked in 2011

In June 2011, seven Taliban fighters attacked the same hotel over several hours. In the end, all seven, along with 11 other people, were dead.

The InterContinental Hotels Group developed the hotel, which opened in 1969. But the hotel has had no association with the group since the Soviet invasion in 1979, though it continues to use the name without connection to the international company.