Secretary of Defense Leon Panetta greets members of the Libyan delegation on the tarmac during his arrival in Tripoli, Libya, on Saturday. (Pablo Martinez Monsivais/AP)

— Nine months after American and NATO air power was deployed to rescue a faltering rebellion against Moammar Gaddafi, Defense Secretary Leon E. Panetta made a historic visit here Saturday to offer symbolic support for Libya’s post-revolutionary government as it tries to stabilize the North African country.

Panetta, who took office in July as the civil war was raging, is the first Pentagon chief to visit Libya after decades of hostile relations between Washington and Gaddafi. His trip was the latest effort by the Obama administration to encourage Libya’s fledgling government to move quickly to transition to democracy even as the United States seeks to avoid the appearance of interfering in the country’s volatile internal affairs.

“Libya is now in the hands of the Libyan people,” Panetta said at a news conference at the Libyan Defense Ministry. “This will be a long and difficult transition, but I have every confidence that you will succeed in realizing the dream of a government of, by and for all people and achieve a more secure and prosperous future.”

Panetta’s message to Libyan leaders echoed comments he had made two days before in Baghdad, where he led a ceremony to mark the end of the war in Iraq. Although their circumstances differ, both countries are struggling to adopt democratic practices after the U.S. military ousted, or helped oust, a long-serving autocrat.

Panetta met with Libya’s new prime minister, Abdurrahim el-Keib, as well as its defense minister, Osama al-Jwayli. He was accompanied by Army Gen. Carter Ham, the chief of the U.S. military’s Africa Command and a leading player in NATO’s Libya campaign. The defense secretary said Washington was “prepared to provide whatever assistance that Libya believes it needs” but added that he did not discuss specific aid proposals with Libyan leaders. “They have to determine what their needs are,” he said.

Panetta also laid a wreath at a small cemetery in Tripoli that for two centuries has been the resting place for five American sailors. The sailors were part of a 13-member crew who died during a mission by the USS Intrepid against a Barbary pirate fleet in Tripoli’s harbor in 1804.

Some of the sailors’ descendants have sought for years to have their remains returned to the United States. The Navy favors leaving the cemetery undisturbed, calling it the “final resting place” of the sailors. Congress, however, passed a measure last week calling on the Defense Department to study the possibility of bringing the sailors’ remains home.

Panetta did not comment publicly during his visit to the cemetery, which sits on a bluff overlooking Tripoli’s harbor. In a statement issued afterward, he praised the Libyan government’s efforts to preserve the grave sites. The cemetery had been in a dilapidated condition for many years until a restoration project was completed in January, when Gaddafi was still in power.

Panetta made his brief stopover in Libya despite continuing unrest, including outbreaks of gunfire at the Tripoli airport earlier in the week. Rival militias that had banded together to oust Gaddafi are vying for control and influence in the new government.

Keib said he reassured Panetta that the government was doing its best to unify the militias under a single banner. “We know how serious this issue is,” he said. “We know it’s not just a matter of saying, ‘Okay, put down your arms and go back to work.’ ”

Panetta is the second member of Obama’s Cabinet to visit Libya in two months, following an appearance in Tripoli by Secretary of State Hillary Rodham Clinton on Oct. 19, two days before Gaddafi was killed by rebel forces.

Although U.S. and NATO bombing helped drive Gaddafi from power, the Obama administration avoided deploying U.S. ground forces to Libya. Only a handful of U.S. military personnel are in the country, assigned to security duties at the U.S. Embassy.

One priority for Libya’s new leaders has been to gain access to billions of dollars in assets that Gaddafi had stored in overseas accounts. On Friday, the White House announced that it has lifted remaining sanctions against Gaddafi’s government and that it will unfreeze an estimated $37 billion in Libyan government assets under U.S. jurisdiction.