Al-Shabab, a Somali al-Qaeda-linked group, has asserted responsibility for an hours-long assault on a Kenyan costal town in which 48 people were killed.

The attack in Mpeketoni began Sunday night and lasted until early Monday, with little resistance from Kenya’s security forces. Two hotels and many vehicles were set on fire.

The attack highlights the growing Islamist threat in a country once viewed as a bastion of stability in East Africa, drawing tourists from around the world. In September, an al-Shabab assault on an upscale mall in Kenya’s capital, Nairobi, killed at least 67 people.

The Interior Ministry said that about 8 p.m. Sunday, two minivans entered the town — where many residents were watching the World Cup on TV. Militants disembarked and began their assault. At the Breeze View Hotel, the gunmen pulled the men aside and ordered the women to watch as they killed them, saying it was what Kenyan troops are doing to men in Somalia, a police commander said on the condition of anonymity because he was not authorized to divulge details of the attack. Kenya deployed troops in neighboring Somalia in October 2011 to fight al-Shabab.

The gunmen also went door to door, residents said.

Interior Minister Joseph Ole Lenku said the attackers fled into the nearby wilds after a “fierce exchange of fire” with security forces. He said 20 vehicles were set on fire.

Al-Shabab later said it carried out the assault because of Kenya’s “brutal oppression” of Muslims, including the killings of Muslim scholars in the city of Mombasa. The group said its attacks would go on “as you continue to invade our lands and oppress innocent Muslims.”

Tourists were then warned: “Kenya is now officially a war zone and as such any tourists visiting the country do so at their own peril.”

Kenya’s top police commander, David Kimaiyo, said 48 people were killed. A police spokeswoman said authorities suspect several dozen attackers took part.

Mpeketoni is about 20 miles southwest of the tourist center of Lamu. Tourism in Mpeketoni is mostly local, with few foreigners visiting the area. The town is 60 miles from the Somali border and 360 miles from Nairobi.

Kenya has experienced a wave of attacks in recent months. The United States, Britain, France, Australia and Canada have recently upgraded their terror threat warnings for the country. U.S. Marines have been stationed behind sandbag bunkers for days on the roof of the U.S. Embassy in Nairobi.