KABUL - Security forces said Sunday they had killed the last of six Taliban militants to end an overnight siege at Kabul's Intercontinental Hotel that left at least 18 people dead, including 14 foreigners. Some of the 150 guests fled the gunbattle and fire sparked by the assault by shimmying down bedsheets from the upper floors.

The militants, who wore suicide vests, pinned down security forces for more than 13 hours after the attack began about 9 p.m. Saturday. The gunmen roamed the hallways and targeted foreigners and Afghan officials inside the luxury, hilltop hotel.

The more than 150 people who were rescued or managed to escape included 41 foreigners, said Interior Ministry spokesman Najib Danish. Of those, 10 people were injured, including six security forces, he said.

Eleven of the 14 foreigners killed were employees of KamAir, a private Afghan airline, Danish said. KamAir put out a statement saying some of its flights were disrupted because of the attack.

Six of those killed were Ukrainians, said Ukrainian Foreign Minister Pavlo Klimkin, who added that his office was working with Afghan law enforcement agencies “to clarify the circumstances of this terrorist act.”

Two Venezuelan pilots for KamAir were among the dead, according to Luis Figuera. He told The Associated Press that his brother-in-law, Adelsis Ramos, was killed along with Pablo Chiossone, and that their bodies were identified by another Venezuelan pilot at a Kabul hospital.

A citizen from Kazakhstan also was among the dead at the hotel, according to Anuar Zhainakov, a spokesman for the Kazakh Foreign Ministry.

Afghan security officials confirmed that 34 provincial officials were at the hotel for a conference organized by the Telecommunication Ministry.

Afghan officials said that also among the dead was a telecommunications official from Farah province in western Afghanistan; Waheed Poyan, the newly appointed consul general to Karachi, Pakistan; and Ahmad Farzan, an employee of the High Peace Council, a commission created to facilitate peace talks between the Afghan government and the Taliban and other opposition groups.

The Taliban claimed responsibility for the attack at the heavily guarded hotel that is popular among foreigners and Afghan officials.

Taliban spokesman Zabihullah Mujahid said the insurgents initially planned to strike the hotel Thursday night but postponed it because a wedding was underway there and they wanted to avoid civilian casualties.

The attack unfolded almost six years after Taliban insurgents launched a similar assault on the property.

Mumtaz Ahmad, a provincial telecommunication employee for Helmand province, said he was walking from his room to the reception for his group on Saturday night.

“When the elevator door opened, I saw two armed suicide bombers. People were escaping and the attackers were firing at them,” he said.

Fire broke out in the six-story hotel as the fighting raged, filling some guest rooms with smoke. Explosions could be heard throughout the standoff. Live TV video showed people trying to escape through windows and from the upper stories as thick, black smoke poured from the building.

The Interior Ministry said it is investigating how the attackers managed to enter the building. It said a private company had taken over security about three weeks ago at the hotel, which is not part of the Intercontinental chain.

During a news conference, Danish said that an initial investigation showed that six insurgents entered the hotel from the northern side and stormed its kitchen. A person or persons inside the hotel might have helped the attackers gain entrance, Danish said, adding that the investigation is continuing.

Two of the attackers were killed by special forces on the 6th floor of the hotel.

Capt. Tom Gresback, spokesman for NATO-led forces, said in a statement that Afghan forces had led the response efforts and that no foreign troops were hurt in the attack, according to initial reports.

U.S. Secretary of State Rex Tillerson said the United States strongly condemns the attack, adding that Washington “stands with the government and people of Afghanistan. We remain firmly committed to supporting Afghan efforts to achieve peace, security and prosperity for their country.”

Neighbouring Pakistan also condemned the “brutal terrorist attack” and called for greater co-operation against militants.

Afghanistan and Pakistan routinely accuse each other of failing to combat extremists on their long and porous border.

Afghan forces have struggled to fight the Taliban since the U.S. and NATO formally concluded their combat mission at the end of 2014.

They have also had to contend with a growing Islamic State affiliate that has carried out a number of big attacks in recent years.

In other violence in Afghanistan this weekend, insurgents burst into a home in Balkh province in the north where several members of a pro-government militia were gathered late Saturday, killing 18 of them, said Gen. Abdul Razeq Qaderi, the deputy provincial police chief. Among those killed was a tribal leader who served as the local police commander, he said.

In the western province of Farah, a roadside bomb early Sunday killed a deputy provincial police chief and wounded four other police, according to Gen. Mahruf Folad, the provincial police chief.

The Taliban claimed both attacks.

In the western province of Herat, a roadside bomb struck a vehicle carrying 13 civilians, killing all but one of them, said Abdul Ahad Walizada, a spokesman for the provincial police chief. No one immediately claimed the attack, but Walizada blamed Taliban insurgents, who often plant bombs to target Afghan security forces.