KABUL, Afghanistan — A close adviser to President Hamid Karzai was killed on Sunday night after two gunmen stormed his walled home here. It was the second killing in less than a week of one of the president’s trusted but controversial political allies.

The aide who was killed on Sunday, Jan Mohammed Khan, served as governor of Oruzgan Province until 2006, when he was removed at insistence of Dutch officials over concerns that he was linked to drug rings. Since then, he had been a regular presence at the presidential palace.

He was killed alongside Mohammed Hasham Watanwal, a member of Parliament from Oruzgan.

The killing was another potentially heavy blow for Mr. Karzai, whose powerful half brother Ahmed Wali Karzai was assassinated on Tuesday by a close associate in southern Afghanistan. It also heightened concerns that militants were trying weaken the president’s standing and unravel the tenuous security gains in the still-violent south after months of intensified fighting by NATO and Afghan forces.

In response to the attack, Afghan police officers, soldiers and intelligence officers swarmed Mr. Khan’s neighborhood in western Kabul, where government officials and businessmen live behind high walls and steel gates, protected by many men with many guns.