One of the six U.N. dead was an American, the U.S. Embassy said. A Taliban spokesman claimed responsibility for the early morning assaults, which also included rocket attacks at the presidential palace and the city's main luxury hotel.
The chief of the United Nations mission in Afghanistan, Kai Eide, said the attack "will not deter the U.N. from continuing all its work" in the country.
The attack on the guest house sent people running and screaming outside, with some jumping out upper-story windows to escape a fire that broke out. One American man said he held off the assailants with a Kalashnikov rifle until guests were able to escape.
One rocket struck the "outer limit" of the presidential palace but caused no casualties, presidential spokesman Humayun Hamidzada said. Two more rockets slammed into the grounds of the Serena Hotel, which is favored by many foreigners.
One failed to explode but filled the hotel lobby with smoke, forcing guests and employees to flee to the basement, according to an Afghan witness who asked that his name not be used for security reasons.
President Hamid Karzai condemned the attack as "an inhuman act" and called on the army and police to strengthen security around all international institutions.
Taliban spokesman Zabiullah Mujahid claimed responsibility for the attacks in a telephone call to The Associated Press, saying three militants with suicide vests, grenades and machine guns carried out the guest house assault.
He said three days ago that the Taliban issued a statement threatening anyone working on the Nov. 7 runoff election between Karzai and Abdullah Abdullah.
"This is our first attack," he said.
An official with the U.N. election team said that the guest house was home to the largest concentration of U.N. election workers in the city. The official, who was not authorized to speak to the press so spoke anonymously, did not give a specific number of election workers staying there, but said it was around 20.
Interior Ministry officials said the attackers were wearing old-style police uniforms, which are available in markets. In the southern city of Kandahar, security officials also warned international organizations to be alert to possible suicide attacks.
U.N. spokesman Adrian Edwards said six U.N. staff were killed and nine other U.N. employees were wounded in the assault, which began about dawn in the Shar-e-Naw area of the city. Terrified guests fled the building during the assault - some screaming for help and others jumping from upper floors as flames engulfed part of the three-story building.
Afghan police and U.N. officials said 12 people in all were killed, including the U.N. staff, three attackers, two security guards and an Afghan civilian. The bodies of the attackers were taken out of the house and sent for autopsies, said Gul Mohammad, an officer at the scene.
It was not immediately known how the victims were killed or how the fire started, but witnesses said they heard prolonged gunfire ringing from the house before police arrived at the scene. It also was not immediately clear whether there were any other attackers besides the three killed.
Police were seen pulling the charred body of what appeared to be a woman from a second-floor bedroom. One officer carried an injured German man by piggyback away from the scene.
Terrified guests scrambled over the roof or jumped from windows to escape.
John Turner, a trucking contractor from Kansas City, Mo., said he held off attackers with a Kalashnikov until a group of guests escaped through the laundry room. Miles Robertson, an Australian working as an election adviser, said he and his wife put wet towels over their faces and fled when the room next door caught fire.
Edwards said officials were trying to account for several other U.N. workers who were staying at the guest house. He did not know their nationalities but said they were non-Afghans.
"This has clearly been a very serious incident for us," Edwards said. "We've not had an incident like this in the past."
Edwards said the U.N. would have to evaluate "what this means for our work in Afghanistan." The Aug. 19, 2003, truck bombing of the U.N. headquarters in Baghdad, which killed 22 people, prompted the U.N. to pull out of Iraq for several years.
A security guard, Noor Allah, said he saw a woman screaming for help in English from a second-story window and watched as terrified guests leapt from windows. Afghan police using ladders rescued at least one wounded foreigner.
Afghans are to vote Nov. 7 in a second-round election after U.N.-backed auditors threw out nearly a third of Karzai's votes from the Aug. 20 ballot, determining widespread fraud. That pushed Karzai's totals below the 50 percent threshold needed for a first-round victory in the 36-candidate field.
The Taliban has warned Afghans to stay away from the polls or risk attacks. Dozens of people were killed in Taliban attacks during the August balloting, helping drive down turnout.
Mir Ahmed Formoly, 64, who lives near the guest house, said he heard the commotion and went outside where he saw muzzle flashes in the early morning light.
"I was so scared," he said. "I went back inside the house."
He said gunfire and explosions lasted about two hours, punctuated by shouts and screams.
Mohammad Ayub, a shopkeeper who lives a few doors down from the attacked house, said he heard gunfire shortly before dawn. He assumed at first that it was an attack on a house belonging to relatives of President Karzai nearby, then saw that it was a different building.
"It was early morning, but I didn't have a watch on to know when. It was dark. Shooting started around this private guest house. I heard some shouts coming from inside the house," Ayub said.
"I heard 'Boom! Boom!' several times. The fighting went on inside for about 10 or 15 minutes before the police came," he said.
The guest house attack was the third major assault in the capital in recent weeks.
On Oct. 8, a suicide car bomber detonated his vehicle outside the Indian Embassy, killing 17 people - mostly civilians - and wounding at least 76 more. The Afghan Foreign Ministry hinted at Pakistani involvement - a charge Pakistan denied.
On Sept. 17, a suicide car bomber killed six Italian soldiers and 10 Afghan civilians on one of Kabul's main roadways.
Associated Press Writers Hamza Hendawi, Heidi Vogt, Todd Pitman and Robert H. Reid contributed to this report.