The United States appeared to be closer Tuesday to turning over command of the military operation in Libya, with key NATO countries tentatively agreeing that the alliance would take the leading role.

The agreement emerged after President Obama spoke with key European, Arab and Turkish allies, some of whom had initially opposed a central NATO role.

Speaking to reporters in El Salvador, his final stop on a five-day Latin American trip, Obama said he had “no doubt” that the United States would turn over command of the Libyan operation in “days, not weeks.”

“When this transition takes place, it is not going to be our planes that are maintaining the no-fly zone,” Obama said in an appearance with President Mauricio Funes in San Salvador, the capital. “It is not going to be our ships that are necessarily enforcing the arms embargo. That’s precisely what the other nations are going to do.”

The issue is an urgent one for Obama, who was reluctant to open a military front in a third Muslim country and who has said the United States wants to quickly turn over command of Operation Odyssey Dawn, as the military campaign in Libya is known.

But choosing which nation or alliance will lead the operation once the United States steps aside has proved to be a complicated diplomatic process, shaped by the domestic political considerations facing some governments uncertain of the mission’s merits.

Turkey, the only Muslim-majority member of NATO, had opposed proposals that would place the Libyan operation under the alliance’s control.

Obama called Turkish Prime Minister Recep Tayyip Erdogan on Monday evening, and White House officials suggested Tuesday that Turkish opposition to a large NATO role in running the operation has faded.

On Tuesday, Obama called the emir of Qatar, Sheik Hamad bin Khalifa al-Thani, the only Arab leader to pledge military assets to the mission. He also called French President Nicolas Sarkozy and British Prime Minister David Cameron.

According to U.S., French, and British officials, NATO will take over, with the command working out of different operation centers, including naval facilities in Naples, Italy, and potentially air bases in Turkey.

“NATO will be in charge,” said a U.S. official, speaking on the condition of anonymity while sensitive final discussions continue.

A steering committee of representatives from participating countries would maintain political oversight, providing a non-NATO veneer important to Turkey, where public opinion is mixed over the Libyan mission. The model is similar to that of the International Security Assistance Force in Afghanistan, where troops belonging to NATO nations participate alongside non-NATO contributors.

That structure would also allow Arab participation in the decision-making. The agreement, one U.S. official said, amounts to a compromise reached after Sarkozy, in his phone conversation with Obama, eased off his previous insistence that NATO not be in charge.

Ben Rhodes, the deputy national security adviser for strategic communications, said “the leaders . . . agreed that NATO should play a key role in the command structure going forward for the enforcement of the no-fly zone.”

“Clearly we have a coalition that is going to include nations other than NATO allies and that not every single NATO ally is going to be participating in the enforcement of the no-fly zone,” Rhodes told reporters traveling with the president. “So I think what we’re working through is how to leverage the capabilities within NATO as a part of a command structure that is internationalized when the U.S. shifts.”

The search for a permanent command of the open-ended operation marks the next phase in the intricate diplomacy surrounding the Libyan mission.

After saying Libyan leader Moammar Gaddafi “must leave” for turning against his people, Obama was reluctant to support military operations in Libya, only to be taken by surprise by how quickly rebel forces collapsed in the face of Gaddafi’s counteroffensive.

With a rare Arab League endorsement of a no-fly zone over a member state in hand, Obama pushed for and secured a U.N. Security Council resolution authorizing even broader military action to protect Libyan civilians from Gaddafi’s forces, enforce an arms embargo and establish a no-fly zone over the country.

On Monday, NATO members disagreed during a rancorous meeting in Brussels over who should command the operation after this first phase ends.

German and French representatives walked out of the session after NATO’s secretary general, Anders Rassmussen, criticized their opposition to a NATO-run mission. While France wanted NATO assets under a non-NATO command, Germany objected to NATO’s participation.

A European diplomat familiar with the NATO discussion said the “mood music” had changed Tuesday. “The upshot is that we have increasing convergence on views, a more cooperative atmosphere, but we don’t yet have a final decision,” the official said.

A second European diplomat said “we want to be able to use NATO capabilities for structure, and make sure that we have political leadership for the operation that accommodates non-NATO states. ”

“We have to be able to accommodate Qatar and the [United Arab] Emirates,” the official said.

Neither coalition governments nor NATO has officially signed on to the agreement yet, and administration officials traveling with Obama in Latin America, aware of remaining sensitivities within the alliance and among its outside partners, said the issue was still under discussion.

France, however, issued a statement late Tuesday saying that Obama and Sarkozy had “come to an agreement on the way to use the command structures of NATO to support the coalition.” The statement provided no details.

NATO agreed Tuesday to take control of the arms embargo — largely a naval mission — and a U.S. official said agreement was likely Wednesday on NATO command of a no-fly zone. Still to be formally agreed is who will command the “protection” aspect of the mission, perhaps the most complicated element.

“I want to emphasize to the American people, because of the extraordinary capabilities and valor of our men and women in uniform, we have already saved lives,” Obama said.

Staff writers Joby Warrick in Washington, Colum Lynch at the United Nations, Anthony Faiola in London and Perry Bacon Jr. in San Salvador contributed to this story.