KABUL, Afghanistan — Unnerved by fears of a rushed American deal with Taliban insurgents, President Ashraf Ghani of Afghanistan sent a letter on Tuesday to President Trump offering him reduced costs for keeping United States troops in the country.

The letter, confirmed by three officials and described by one who had seen its contents, is among the strongest signs yet that Mr. Ghani is worried about the consequences of an abrupt American withdrawal from an intractable war that has lasted nearly two decades.

Mr. Ghani has made no secret of his concern about a hasty American exit by an increasingly impatient Mr. Trump, fearing it could unravel the fragile Afghan state and lead to a renaissance in power by the Taliban, which have been steadily gaining territory.

The Afghan leader’s anxiety has punctuated the contrast between the political backdrop in Afghanistan and the circumstances of the American pullout from the other conflict that arose after the Sept. 11, 2001, attacks — the American-led war in Iraq.

The official said the language of Mr. Ghani’s letter was broad — asking for teams from both sides to discuss details of where costs could be reduced, and how the troop levels could be brought down from the current 14,000 to a “more efficient level.”

The official said the possibilities they had envisioned could save as much as $2 billion a year for the United States, drawing from areas such as maintenance contracts, and reduce the level of American troops to as low a 3,000.

Mr. Ghani alluded to such savings during an appearance last week at the World Economic Forum in Davos, Switzerland, in which he argued for caution in any American withdrawal.

“The United States as a sovereign power, as a global power, is entitled to leave,” he said. “But we need to get the departure right. Are the fundamental reasons that brought the United States to Afghanistan — are those objectives accomplished? The first issue is cost. We completely agree that the cost must come down, must become more efficient.”

The United States Embassy in Kabul declined through a spokesperson to comment on Mr. Ghani’s letter to Mr. Trump, saying “we are not going to get into the specifics of diplomatic conversations.”

It was not immediately clear on Tuesday whether Mr. Trump had received the letter yet. It was sent to him via Alice Wells, the principal deputy assistant secretary for South and Central Asia, who had been visiting Kabul. A spokesman for Mr. Ghani also declined to discuss the letter.

Mr. Ghani has found himself increasingly at odds with other members of the Afghan political elite, who are now rallying around the American effort to negotiate with the Taliban. They are painting Mr. Ghani as an obstacle to peace.

“We should not forget that the victims of war are Afghans, so the initiative of peace should be in the hand of Afghans,” Mr. Ghani said in his address.

In another sign of tension with the Americans, Mr. Ghani noted how Afghans are “killed in airstrikes,” a criticism of the United States military he rarely makes publicly. Amrullah Saleh, Mr. Ghani’s interior minister until recently, and who will be running as his vice president in the July elections, was even more emotional.

“Why should Afghans be under this enormous psychological pressure that ‘you are a dependent nation?’” Mr. Saleh said in an interview on the BBC.

“Of course economically we are dependent. But security-wise, also remember the West is dependent on us,” he said. “We are giving the ultimate sacrifice for global security. It’s been our blood and our bones. From the West, recently, it’s only been money and metal — money and weapons. So please, make sure this is not considered a charity case. We are a partner.”

Many of Afghanistan’s opposition leaders see Mr. Ghani as resistant to Americans’ pushing a peace deal because, they said, he worries it could hurt his bid for a second five-year term.

“Instead of creating hope and leading this critical process, the government is trying to damage the process and create fear among the people,” said Hanif Atmar, a former national security adviser challenging Mr. Ghani in the elections.

Mr. Atmar said the government should embrace the prospect of negotiations with the Taliban, and “can only play that role if it comes out of its corner of isolation and narrow-mindness to unite the country and be prepared to sacrifice power for peace.”

In return, Mr. Ghani’s officials say his rivals are blindly embracing the momentum in the American and Taliban talks because they see in it the promise of an interim government that will give them a share of power — even if it means putting the gains of the past 17 years in jeopardy.

Mr. Ghani’s aides warn that a rushed deal, like the one forged in the political vacuum created after the Soviet occupation ended in 1989, can lead to anarchy and bloodshed.

“He has history on his side,” Davood Moradian, the director of the Afghan Institute for Strategic Studies, said of Mr. Ghani’s concerns. “There are many cases that the United States has abandoned its allies, from the shah of Iran to Mubarak of Egypt. He is right to be worried about U.S. abandonment of Afghanistan.”

Worries about a United States withdrawal were reinforced in a report released early Thursday by the Special Inspector General for Afghanistan Reconstruction, an American agency. The Afghan government’s control over the country has declined, the report said, with 63 percent of the population living in areas under the central government’s control as of last fall.

The setback came as the American military ramped up its bombing campaign across Afghanistan fivefold over 2016. Last year alone, American aircraft dropped more than 6,800 munitions, according to the inspector general’s report.

Mr. Moradian said part of Mr. Ghani’s resistance might be an interest in securing another term, but what is at stake for Afghanistan is the future of a system built at enormous cost.

“Knowing Ashraf Ghani,” Mr. Moradian said, “I think he is pursuing self-interest. But in this juncture of history, his interest has been aligned with the interest of state-building and the constitutional order.”