The Kenyan army said it had repelled a machete attack on a military barracks in a tourist resort near Mombasa on Sunday, killing six assailants.
About a dozen youths tried to break into the barracks in the Indian Ocean town of Nyali at around 5:30 am (0230 GMT), the army said in a statement.
"Soldiers... responded, killing five of the men. The sixth was pursued and shot dead in a nearby forest."
The army said one soldier was hacked with one of the attackers' machetes and was being treated for his injuries.
There was no immediate information about the identity of the attackers.
However, Kenya has been hit by a string of attacks in recent months blamed on Somalia's Shebab Islamist insurgents.
Kenyan troops are fighting the extremists in Somalia as part of an African Union force.
Mombasa County Commissioner Nelson Marwa said the assailants were met with "fierce fire" even though the soldiers were probably sleeping when the attack started.
"How on earth would a gang of criminals in their normal minds want to raid an army barracks, in an independent country," he said.