A Kenyan military official says that troops shot and killed six machete-wielding attackers who tried to gain entry into a barracks on the coast.

Spokesman Col. David Obonyo said the gang of about 15 people tried to carry out the Sunday morning attack in Mombasa. Initially two attackers tried to attack a military guard with machetes, then troops opened fire.

One attacker was caught and arrested and is being investigated. Authorities estimate that eight escaped.

Meanwhile, the government on Sunday confirmed that 22 police were killed in an ambush on Saturday in the country's north. A preliminary death toll on Saturday said eight police had been killed.

President Uhuru Kenyatta traveled to the site of the attack, Kapedo, on Sunday to talk with local leaders.