An inmate in a Baghdad prison grabbed an assault rifle from a guard and opened fire, killing eight people, police said. One American soldier was injured in the attempted prison break, the U.S. military said.

In Wednesday's prison escape attempt, the prisoner fired indiscriminately after grabbing an AK-47, killing four guards and four inmates, said Iraqi army Brig. Gen. Jalil al-Mehamadawi. The Interior Ministry said one guard and three prisoners were wounded.

The U.S. military's account was slightly different. A statement by Sgt. Keith Robinson said "it was reported that 16 prisoners attempted to escape the facility after first storming the armory and obtaining an undetermined number of weapons." U.S. forces are often stationed alongside Iraqis in prisons.

Robinson said in addition to the eight deaths that one U.S. soldier and five prisoners were injured, but the U.S. statement did not mention the assault rifle.

Guards overtook the gunman and restrained him, al-Mehamadawi said. The prison was a Justice Ministry facility that also housed foreigners, officials said.

A United Nations official said Wednesday that Iraq's recent elections were credible and there was no justification for a rerun of the vote that gave a strong lead to the Shiite religious bloc dominating the current government.

The Shiite bloc held talks with Kurdish leaders and said preparations were being made to choose a candidate for prime minister — who they have said must come from their governing United Iraqi Alliance.

"We set up the mechanism to elect the new prime minister but have not started it yet. Any member of the Alliance has the right to be nominated for that post," Alliance leader Abdul Aziz al-Hakim told the Kurdish parliament.

Alliance officials have indicated likely candidates were current Prime Minister Ibrahim al-Jaafari, who heads the Islamic Dawa party, and Adel Abdul-Mahdi, who belongs to the other main Shiite party, the Supreme Council of the Islamic Revolution in Iraq.

Al-Hakim also discussed who should get the top 12 government jobs, as thousands of Sunni Arabs and secular Shiites protested what they say was a tainted vote.

Two Sunni Arab groups and former Prime Minister Ayad Allawi's Iraqi National List have threatened a wave of protests and civil disobedience if fraud charges are not properly investigated.

In another of continuing political demonstrations across the country, more than 4,000 people rallied Wednesday in Samarra, 60 miles north of Baghdad, in favor of the major Sunni Arab party, the Iraqi Accordance Front. Demonstrators carried banners say "We refuse the election forgery."

The United Nations official, Craig Jenness, said at a news conference organized by the Independent Electoral Commission of Iraq that the U.N.-led international election assistance team found the elections to be credible and transparent. "Turnout was high and the day was largely peaceful, all communities participated."

His statement and the negotiations between Iraqi factions come at a critical time, with the United States placing high hopes on forming a broad-based coalition government that will provide the fledgling democracy with the stability and security it needs to allow American troops to begin returning home.

Iraqi officials said they had found some instances of fraud that were enough to cancel the results in that place, but not to hold a rerun. There were more than 1,500 complaints made about the elections, with about 50 of them considered serious enough to possibly result in the cancellation of results in some places.

"After studying all the complaints, and after the manual and electronic audit of samples of ballot boxes in the provinces, the electoral commission will announce within the next few days some decisions about canceling the results in stations where fraud was found," said Abdul Hussein Hendawi, an elections official.

He said fraud had been discovered in the provinces of Baghdad, Irbil, Ninevah, Kirkuk, Anbar and Diyala.

Jenness said the number of complaints was less than one in every 7,000 voters. About 70 percent of Iraq's 15 million voters took part in the elections. He added that the U.N. saw no reason to hold a new ballot.

"Complaints must be adjudicated fairly, but we in the United Nations see no justification in calls for a rerun of any election," he said.

The negotiations between the majority Shiites and Kurds were seen as part of an effort to force the main Sunni Arab organizations to come to the bargaining table. All groups have begun jockeying for position in the new government, and the protests are widely considered to be part of an attempt by Sunni Arabs to maximize their position.

Sunni Arabs formed the backbone of Saddam's government, and the Bush administration hopes to pull them away from the insurgency that has ravaged the country with daily bloodshed.

Preliminary results from the Dec. 15 vote have given the United Iraqi Alliance a big lead, but one unlikely to allow it to govern without forming a coalition with other groups. Final results are expected early next month, but the Shiite religious bloc may win about 130 seats in the 275-member parliament — short of the 184 seats needed to avoid a coalition with other parties.