Updated

KABUL, Afghanistan (AP) — America's top diplomat in Kabul jokingly handed NATO's new commander Gen. David Petraeus an access badge to the U.S. Embassy on Saturday, a symbolic gesture of a new partnership in the troubled U.S. management of the Afghan war.

The smiles and declarations of synergy came as Petraeus prepared to formally assume command on Sunday of a 130,000-strong international force at a time of rising casualties and growing doubt about how much can be achieved before July 2011 when President Barack Obama wants to begin withdrawing U.S. troops.

Petraeus called for troops and civilian staff employees to work together, saying: "In this important endeavor, cooperation is not optional."

His predecessor, Gen. Stanley McChrystal, was fired last month for intemperate remarks that he and his aides made to Rolling Stone magazine about Obama administration officials, mostly on the civilian side.

"Civilian and military, Afghanistan and international, we are part of one team with one mission," Petraeus told about 1,700 invited guests, including Afghan government and military and police officials gathered at the U.S. Embassy for a pre-Fourth of July celebration marking American independence.

They were Petraeus' first public comments since he arrived Friday night to take command of U.S. and NATO forces in Afghanistan. He said he would work to improve coordination between troops on the battlefield and civilians trying to bolster the Afghan government and improve the lives of the people.

His message to the Afghans in the audience: "Your success is our success."

Petraeus, widely credited with turning around the U.S. war effort in Iraq, faces rising violence and growing doubts in Washington and other allied capitals about the effectiveness of the counterinsurgency strategy, which the general himself pioneered.

June was the deadliest month for the allied force since the war began in October 2001 with 102 deaths, more than half of them Americans. Britain's Ministry of Defense reported that a Royal Marine was killed on Thursday in southern Afghanistan — the fifth international service member killed this month.

Later, Petraeus met with Afghan President Hamid Karzai. Corruption was one of the issues the two discussed, according to a statement issued by the presidential palace. Karzai used the meeting to complain about what he said were "baseless" allegations made by U.S. Rep. Nita Lowey, a Democrat from New York, who suggested that Afghan government officials had misused or pocketed donor funds, Karzai's office said.

Karzai asked Petraeus to review international contracts for private security companies to help keep money from flowing out of the country. According to the statement, Petraeus told the president that he would begin his job by emphasizing "unity, accountability and transparency."

U.S. Ambassador Karl Eikenberry underscored the message of cooperation and said the U.S. was "committed for the long-term" because a stable Afghanistan, free of extremist threats, would help ensure security in the United States.

Eikenberry had frosty relations with former NATO commander Gen. Stanley McChrystal, who told Rolling Stone that he felt "betrayed" by the ambassador's opposition last year to a request for a substantial increase in U.S. troops in Afghanistan. Eikenberry's opposition to Obama's decision to send 30,000 U.S. reinforcement to Afghanistan — based on doubts about Karzai's reliability — was contained in diplomatic cables leaked in Washington, a move McChrystal suspected was aimed at protecting the ambassador if the war effort failed.

Eikenberry called Petraeus a "great friend" and handed him an access pass to the heavily guarded embassy across the street from NATO headquarters in Kabul.

"Welcome aboard. You are welcome at this embassy 24-7," Eikenberry said.

"It's a pleasure to be your Ranger buddy at this critical time" Petraeus told Eikenberry, a retired lieutenant general who like the new commander graduated from the Army's elite Ranger training school.

The gathering was upbeat. A rock band played. Dignitaries sat in tents eating popcorn, hamburgers, fried chicken, cupcakes and ice cream. Tiny American flags lined the sidewalks of the U.S. Embassy compound, which was adorned in red, white and blue bunting.

The positive tone, however, was dampened by talk of Friday's attack on a four-story house used by an American aid organization in the northern city of Kunduz and the accidental killing of civilians during a raid in the south.

Taliban suicide attackers stormed the house, killing four people before dying in a five-hour gunbattle with Afghan security forces. The pre-dawn attack appeared part of a militant campaign against international development organizations at a time when the U.S. and its allies are trying to accelerate the civilian aid effort to turn back the Taliban.

During the picnic, NATO issued a statement acknowledging the deaths on Friday of two Afghan civilians, including a woman, in a joint raid with Afghan troops to arrest a Taliban deputy commander in the Kandahar area.

During the raid, an Afghan man left a compound and "demonstrated hostile intent," NATO said. Troops opened fire, wounding the man. When troops entered the compound, they found an Afghan woman dead from stray rounds and another man wounded, the alliance said. One of the two wounded men later died.