Updated

The Islamist terror group al-Shabaab has claimed responsibility for a brutal, religiously-motivated attack in Kenya that killed 48 people Sunday night.

Kenyan police official David Kimaiyo said Monday that gunmen targeted two hotels, a bank and a police station in Mpeketoni, a coastal resort town 60 miles from the Somali border and  popular with Western tourists.

Al-Shabaab -- Somali militants linked to Al Qaeda -- admitted Monday to carrying out the coordinated assault, which began Sunday and lasted through Monday morning, with little resistance from Kenya's security forces.

The group said the attack was a response to Kenya's "brutal oppression of Muslims in Kenya," including the killings of Muslim scholars in Mombasa, a possible reference to the recent Muslim leader deaths in that Kenyan coastal city.

Kenyan officials said at least two of the hotels were set on fire. It was not immediately clear how many attackers were involved, but a police spokeswoman said it was believed that "several dozen" took part.

Sky News reported that the gunmen's assault began at approximately 8 p.m. local time (1 p.m. Eastern Time) as residents watched World Cup matches on TV. Cafes and bars in the town were reportedly packed with people watching the game between Switzerland and Ecuador. Kenya's National Disaster Operations Center said military surveillance planes were launched shortly afterward and gunshots were heard four hours later.

One police commander said that as residents were watching the World Cup at the Breeze View Hotel, the gunmen pulled the men aside and ordered the women to watch as they killed them. The attackers told the women that that's what Kenyan troops are doing to Somali men inside Somalia. The police commander insisted on anonymity because he was not authorized to share that detail of the attack.

Kenya's Interior Ministry said the gunmen arrived in two hijacked minivans. Like the gunmen who attacked Nairobi's Westgate Mall last year, the Mpeketoni attackers gave life-or-death religious assessment, a witness said, killing those who were not Muslim.

"They came to our house at around 8 p.m. and asked us in Swahili whether we were Muslims. My husband told them we were Christians and they shot him in the head and chest," said Anne Gathigi.

Another resident, John Waweru, said his two brothers were killed because the attackers did not like that the brothers did not speak Somali.

"My brothers who stay next door to me were killed as I watched. I was peeping from my window and I clearly heard them speak to my brothers in Somali and it seems since my brothers did not meet their expectations, they sprayed them with bullets and moved on," said Waweru.

Interior Minister Joseph Ole Lenku said the attackers fled into the nearby wilds, known as the Boni Forest, after a "fierce exchange of fire" with security forces. He said 20 vehicles had been set on fire.

Al-Shabaab warned tourists Monday to stay away from Kenya, saying that the once peaceful East Africa nation "is now officially a war zone."

Mpeketoni is about 20 miles southwest of the tourist center of Lamu. Any 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 the capital, Nairobi.

Al-Shabaab has been blamed for a number of attacks in retaliation for Kenya's deployment of troops in neighboring Somalia, where the group has been trying to seize power. Most notably, al-Shabaab was thought to be behind last September's attack on Nairobi's Westgate mall, in which 67 people were killed.

The U.S., U.K., France, Australia, and Canada have all recently upgraded their terror threat warnings for the country.

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

Lamu is a UNESCO World Heritage Site and is the country's oldest continually inhabited town. The region saw a spate of kidnappings of foreign tourists in 2011 that Kenya said was part of its motivation for attacking Somalia. Since those attacks and subsequent terror warnings, tourism has dropped off sharply around Lamu.

The Associated Press contributed to this report. 

Click for more from Sky News.