Gunmen have attacked Kabul's Intercontinental Hotel, seizing hostages and exchanging gunfire with security forces as the building in the Afghan capital caught fire and residents and staff fled.

Isis was suspected to be behind the bloodshed, which came after numerous atrocities by its militants in Afghanistan and attacks on hotels around the world, but there was no immediate claim of responsibility.

Hotel manager Ahmad Haris Nayab, who escaped unhurt, said the attackers had got into the main part of the hotel through a kitchen and people tried to get out amid bursts of gunfire.

Several people had been killed and at least six wounded in the raid, which came days after a US embassy warning of possible attacks on hotels in Kabul, Nasrat Rahimi, an interior ministry spokesman, said. However, officials gave no other details on casualty numbers.

There was no immediate claim of responsibility for the latest in a long series of attacks which underlined the city's precarious situation and the ability of militants to strike blows aimed at undermining confidence in the Western-backed government.

Officials said there were as many as four attackers and at least two of them had been killed as Afghan Special Forces cleared the first floor and moved up the building, battling the raiders, who appeared to have a large supply of hand grenades.

Afghan security officials take up positions near the scene of attack by armed men at a hotel in Kabul (EPA)

Hours after the attack began at 9pm local time (4.30pm GMT), firing appeared to ease as security forces settled in, waiting for dawn.

According to one witness, who did not want to be named, the attackers took hotel staff and guests hostage. He said some foreigners were among the hotel guests but it was not clear what their nationality was.

The Intercontinental Hotel, located on a hilltop and heavily protected like most public buildings in Kabul, was previously attacked by Taliban fighters in 2011.

It is one of two main luxury hotels in the city and had been due to host an information technology conference on Sunday. More than 100 IT managers and engineers were on site when the attack took place, Ahmad Waheed, an official at the telecommunications ministry, said.

The attack came days after a United Nations Security Council visit to Kabul to allow senior representatives of member states to assess the situation in Afghanistan.

Many details of the incident were still unclear, but interior ministry spokesman Najib Danish said a private company had taken over security about three weeks ago.

Protesters demand better security in Kabul Show all 10 1 /10 Protesters demand better security in Kabul Protesters demand better security in Kabul A woman tries to stop police from firing on protesters during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Afghan security officials use a water cannon to disperse demonstrators as they protest against a suicide bomb attack in Kabul, Afghanistan, 02 June 2017. At least 90 people were killed and more than 350 wounded in a suicide bomb attack near the foreign embassies in Kabul on 31 May. AP Protesters demand better security in Kabul A policeman rests during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters shout anti government slogans during a demonstration to protest against the lack of security in Kabul, Afghanistan, Friday, Jun 2, 2017. Some 500 people are demonstrating in Kabul for better security in the Afghan capital in the wake of a powerful truck bomb attack that killed 90 people. AP Protesters demand better security in Kabul Police forces run as protesters throw stones during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters shout anti government slogans during a demonstration to protest against the lack of security in Kabul, Afghanistan, Friday, Jun 2, 2017. Some 500 people are demonstrating in Kabul for better security in the Afghan capital in the wake of a powerful truck bomb attack that killed 90 people. AP Protesters demand better security in Kabul Protesters throw stones toward security forces during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. ( AP Protesters demand better security in Kabul Police forces run as protesters throw stones during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters throw stones toward security forces during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul A boy walks past protesters during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP

The US embassy in Kabul had issued a warning to American citizens on Thursday, saying: “We are aware of reports that extremist groups may be planning an attack against hotels in Kabul.”

Captain Tom Gresback, spokesman for the Nato-led Resolute Support mission in Afghanistan, said they were watching closely but it was not clear whether international forces took part in suppressing the attack.

“Afghan National Defense and Security Forces are leading the response efforts. According to initial reports, no Resolute Support or (US forces) members were injured in this incident,” he said.

Although the Nato-led Resolute Support mission says the Taliban has come under pressure after the US increased assistance to Afghan security forces and stepped up air strikes against insurgents, security remains precarious.

As pressure on the battlefield has increased, security officials have warned that the danger of attacks on high-profile targets in Kabul and other cities would increase.

After repeated attacks in Kabul, notably an incident last May in which a truck bomber killed at least 150 people outside the German embassy, security has been further tightened.

While it shares the same name, the hotel in Kabul is not part of InterContinental Hotels Group (IHG), which issued a statement in 2011 saying that “the hotel Inter-continental in Kabul is not part of IHG and has not been since 1980”.