Elite Kenyan security forces on Sunday killed a man at the home of Deputy President William Ruto, ending a 20-hour siege that left one officer dead and another wounded, security officials said.
Ruto and his family were not at the vast property in the northwest of the country when Saturday's attack began, less than two weeks before what are expected to be tightly-fought elections.
Ruto condemned the violence at a campaign rally on Sunday.
"Those who seek to frustrate our unity, undermine our progress or work towards destroying our nationhood will not succeed," he told supporters in the town of Murang'a.
There are differing accounts on how many attackers were involved but the incident appeared to have ended Sunday when Kenya's police chief Joseph Boinnet said one assailant was shot and killed.
"The situation is under control," he said, noting that the drama started when a machete wielding man attacked and badly injured a police officer guarding Ruto's home, before storming the compound.
Regional security coordinator Wanyama Musyambo said the assailant then took one officer hostage in a room used as an armoury by police guards.
"It was a very delicate operation because, being in the armoury, he was at an advantage and was firing various weapons, and this caused confusion because you would think there was more than one person firing," Musyambo said.
Both the officer taken hostage and the gunman were later killed, Musyambo said.
Several security sources had earlier told AFP that the assault was staged by several people using guns, raising the possibility that some of the attackers remain at large.
"There are armed people who staged the attack and have shot the GSU officer and stolen his gun," one security official said, referring to the elite police General Security Unit deployed to guard Ruto's house.
The deputy president had left the house shortly before the attack to attend rallies alongside President Uhuru Kenyatta, his running mate who faces a re-election contest on August 8 against longtime opposition leader Raila Odinga.
Saturday's attack occurred despite the round-the-clock presence of GSU guards at the property, near the town of Eldoret, some 300 kilometres (200 miles) northwest of the capital Nairobi.
Moses Wetang'ula, leader of one of five opposition parties in the coalition backing Odinga, called the incident "unfortunate" in comments to The Standard newspaper, but questioned if it wasn't also an attempt to heighten security fears ahead of the vote.
"We hope it is not a ploy to play victim," Wetang'ula said.
Ruto's home sits in Kenya's western Rift Valley area, the flashpoint for an outbreak of election violence after the disputed 2007 polls that killed 1,100 people and tarnished Kenya's image as a regional beacon of safety and stability.
According to opinion polls, this year's election will be close and tensions have been rising.
Odinga has repeatedly claimed the government is scheming to steal the election, while Kenyatta has accused Odinga of trying to delay the polls.
Earlier this month, Human Rights Watch said it had received reports of threats and voter intimidation in Naivasha, a hotspot town in 2007 and one of the potential trouble spots in this year's election.
In the Rift Valley, hate speech flyers have been circulating and some local residents have already left their homes.
The 2007 bloodshed haunted both Ruto and Kenyatta long after it ended, when the International Criminal Court put both on trial for orchestrating the violence.
Those charges were later dropped, with ICC chief prosecutor Fatou Bensouda blaming a relentless campaign of victim intimidation for making a trial impossible.