At least 29 people have been killed by Al Shabaab gunmen in raids on two separate areas on the Kenyan coast.

The Somali Islamist militant group said it staged an attack on Saturday night in the coastal area.

Nine people were killed at the Hindi trading centre in Lamu county, while another 20 people were killed in a separate attack in the Gamba area of neighbouring Tana River county.

Interior ministry spokesman Mwenda Njoka said the number of casualties "could rise".

Officials said a group of 10 to 15 men struck at Hindi about 10:00pm (local time) on Saturday.

"They went around shooting at people and villages indiscriminately," area chief Abdallah Shahasi said.

Lamu county commissioner Miiri Njenga said the attackers targeted government offices and some properties were burnt down.

Al Shabaab said it had broken into Gamba's police station 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," the police source said.

"We still don't know how many detainees were freed until we verify with registers at the station."

The Kenyan Red Cross said three people, from both areas, were taken to hospital with injuries and said another person 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 for Kenya.

Reuters