WASHINGTON — As first vice president of Afghanistan, Abdul Rashid Dostum is the second-ranking official in a country that is almost wholly dependent on U.S. military and financial might, and he is eager to visit Washington and discuss how best to overcome the Taliban.

The only problem is that Dostum, who has been accused of war crimes, is not welcome in the United States.

Dostum’s ascent to the vice presidency of Afghanistan, despite his past, exemplifies a central American failure in a war it is now fighting for the 15th year. In its effort to defeat the Taliban, the United States has built and paid for a government that is filled with the kinds of warlords and power brokers whose predatory ways helped give rise to the insurgent movement in the 1990s, and who U.S. officials say pose as much of a threat to the stability of Afghanistan as the insurgents themselves.

And so, this month, U.S. officials found themselves in the unusual position of threatening to deny a visa to the No. 2 official in a government whose survival depends on the presence of nearly 10,000 U.S. troops and tens of billions of dollars a year in assistance.

The message was passed to the Afghan government days before Dostum was to depart for a trip to New York and Washington, according to multiple Afghan and U.S. officials. To avoid a humiliating public spectacle, the Afghan government quickly and quietly canceled Dostum’s visit, the officials said.

The State Department would not comment on Monday, saying it could not discuss individual visa cases for privacy reasons. But for years, there has been broad agreement among U.S. officials about Dostum, who stands apart for his brutal past even when measured against the alleged crimes and misdeeds of many of the people the United States has relied on during the war in Afghanistan.

The State Department has called him “the quintessential warlord.” A former U.S. ambassador to Afghanistan, Karl W. Eikenberry, warned in 2009 that Dostum’s mere presence in the country would “endanger much of the progress made in Afghanistan.”

That same year, Ashraf Ghani, who is now Afghanistan’s president, called Dostum a “known killer.” But that was years before Ghani decided that he needed Dostum, an ethnic Uzbek, to help secure votes among Uzbeks, one of Afghanistan’s crucial minorities in the 2014 presidential election.

Asked about his aborted visit, Dostum said in an interview on Saturday with Voice of America radio that the tenuous security situation at home had required him to cancel the trip, which was to include an address to a special session of the U.N. General Assembly on narcotics trafficking (something Dostum has been accused of profiting from).

“I personally intend to visit as soon as the situation here allows,” Dostum said in the interview, which was conducted and broadcast in Dari.

He assured listeners that he had many friends in Washington — “I am well acquainted with our Pentagon friends and congressmen,” he said — and that he would tell them how things were in Afghanistan.

“I want to discuss the situation with them,” he said. “They have to take this issue seriously. Otherwise, it might get out of control.”

That discussion seems unlikely to happen anytime soon Dostum’s inability to secure entry to the United States is in fact a long-standing issue.

In 2013, Rep. Dana Rohrabacher, R-Calif., who has known Dostum for decades, personally asked Secretary of State John Kerry to grant him a visa. At the time, Rohrabacher said he was seeking to bring Dostum to Washington to discuss the war and the future of the Afghan government.

No visa was issued then, and Dostum’s election as vice president the following year has not changed the Obama administration’s view of him or its willingness to let him visit the United States, said two senior U.S. officials, who spoke on the condition of anonymity to avoid antagonizing the Afghan government. U.S. officials do not want to be seen with him, one said.

At the outset of the war, Dostum fought alongside Central Intelligence Agency operatives and Special Operations forces to oust the Taliban, and he was initially very close to the U.S. military. In the years immediately after the Taliban fell, he was known to show American guests at his compound in the northern city of Shibarghan a pistol that he said had been given to him by Gen. Tommy R. Franks, who was then in charge of the U.S. Central Command.

But Dostum quickly fell out of favor with his U.S. patrons over his open defiance of the new government in Kabul. In 2004, the United States even sent a B-1 bomber to fly mock bombing runs over his house after his militia seized control of a city in northern Afghanistan from the government.

President Barack Obama said in 2009 that his administration would investigate the allegations of war crimes against Dostum, which center on the killings of hundreds of Taliban prisoners by Dostum’s militia.

The killings took place over three days in late 2001, when Taliban prisoners were stuffed into shipping containers with no food or water. Many suffocated, according to survivors and witnesses, and others died when guards shot into the containers. All are believed to have been buried in a mass grave in Dasht-i-Leili, a stretch of desert just outside Shibarghan, the seat of Dostum’s domain in northern Afghanistan.

The first detailed reports of the killings emerged in early 2002. But U.S. officials and human rights groups have said that the administration of President George W. Bush discouraged efforts to investigate the deaths. Dostum was on the CIA payroll at the time, and the Bush administration also feared that an investigation would undermine the Afghan government, in which Dostum was by then a defense official.

The Obama administration initially appeared to have no such misgivings. Obama told CNN in 2009, “The indications that this had not been properly investigated just recently was brought to my attention.”

“So what I’ve asked my national security team to do is to collect the facts for me that are known, and we’ll probably make a decision in terms of how to approach it once we have all of the facts gathered up,” he said.