Gunmen killed at least 29 people in raids on two separate areas on the Kenyan coast, the interior ministry said.
The Somali Islamist militant group al Shabaab, which attacked the Westgate shopping mall in Nairobi last September, said it had staged an attack on Saturday evening in the coastal area.
Nine people lost their lives at the Hindi trading centre in Lamu county, near the scene of attacks in which 65 people were killed last month, Mwenda Njoka, the ministry's spokesman told Reuters.
Another 20 people were killed in another attack in the Gamba area of neighbouring Tana River county. Both counties are situated north of the port of Mombasa.
"There were two attacks in Lamu and Tana River last night. In Lamu we have nine people dead and in Tana River we have 20. The number could rise," Njoka said by telephone.
Officials said a group of 10-15 men struck at Hindi, situated 15 km (9 miles) from the town of Lamu, and close to the town of Mpeketoni, which was nearly destroyed in one of the attacks in June, at about 10 pm on Saturday.
"They went around shooting at people and villages indiscriminately," Abdallah Shahasi, the area chief, told Reuters.
Al Shabaab said it had broken into the police station at Gamba and freed suspects from the detention cells. A Kenyan police source corroborated that account.
"They killed some of our colleagues and freed Muslim detainees. Some of those freed were linked to the Mpeketoni attacks two weeks ago. We still don't know how many detainees were freed until we verify with registers at the station," the police source who asked not to be named, told Reuters.
Miiri Njenga, the Lamu county commissioner, said the attackers targeted government offices and some properties were burnt down.
The Kenyan Red Cross said three people were taken to hospital with injuries, from both areas, adding another one was reported missing in Gamba.
The wave of gun and grenade attacks along the coast and in Nairobi has hurt the tourism business, a leading source of foreign exchange.