Eleven Somali al-Shabaab militants and two Kenyan soldiers were killed during the attack.

MOMBASA, KENYA - Eleven Somali al-Shabaab militants and two Kenyan soldiers were killed when the al-Qaeda-linked fighters attacked a military base on Kenya's northern coast near to the Somali border on Sunday, a local official and a military spokesman said.

The militants carried out the early morning raid on the military base near the town of Baure in Lamu County, said Lamu's deputy county commissioner, Joseph Rotich.

Militants also stormed Mangai village where they forced men out of their houses and took them to a local mosque where they led prayers for an hour before they disappeared.

"The militants tried to force entry into the camp and that's when the battle ensued," David Obonyo, a Kenyan military spokesman said, adding that Kenyan forces were searching for militants who were believed to have fled into a nearby forest.

Obonyo said the military had seized weapons including 13 AK-47 rifles, five rocket-propelled grenades and eight grenades.

Al-Shabaab confirmed the attack in a statement and claimed its militants had "killed many Kenyan soldiers." Al Shabaab often cites higher death tolls or casualty figures than numbers given by officials.

Kenya is preparing to mark the anniversary of two attacks in the town of Mpeketoni, also in Lamu County, in which militants killed at least 60 people a year ago.

Although Mpeketoni is inland from Kenya's Indian Ocean coastline, the attacks froze the tourism industry in Lamu, which had been popular with tourists from Europe and North America.

Al Shabaab, which seeks to overthrow the Western-backed Somali government and impose its strict interpretation of Islamic law, has frequently targeted neighbouring Kenya in recent years, saying it is retaliating for Kenya's participation in an African Union peacekeeping force in Somalia.

Last month, al-Shabaab gunmen killed around 25 Kenyan police, ambushed some officers in a village in the east of the country after others died when their vehicle hit a landmine planted by the militants, their military spokesman said.

The Islamist group also burnt five vehicles in the two incidents, Sheikh Abdiasis Abu Musab said.

In April, al-Shabaab militants raided a university in the northern Kenyan city of Garissa, killing nearly 150 students, and in September 2013 militants killed at least 67 people in an attack on Nairobi's upmarket Westgate mall.

At the same time, a report, released last week, has shown that the number of visitors to Kenya fell by 25 percent in the first five months of 2015, according to tourism board figures, showing just how badly the industry has been damaged by a spate of Islamist militant attacks that have killed hundreds.

Tourism is a vital foreign exchange earner for the east African nation, which boasts palm-fringed beaches and safari trails, but a two-year slump has forced hotels to shut, cut job numbers and sent the shilling to 3-1/2-year lows.

Visitor numbers fell to 284,313 from 381,278 in January to May 2014, a drop of 25.4 percent, according to Kenya Tourism Board figures obtained by Reuters. That follows a fall of 4.3 percent a year before.

The number of visitors from Britain, the biggest contingent, fell by 35 percent to 36,022 in the period. Tourist arrivals from the United States dropped 22 percent to 30,083.