It was days before Russia invaded Ukraine in February 2022, and the U.S. government was urging Americans to stay away from Russia. That’s when Bill Richardson boarded a plane to Moscow.

The former New Mexico congressman, governor and cabinet member was pursuing his passion: freelance diplomacy with a dangerous foreign government. In this case, Mr. Richardson was headed to the Russian capital in an effort to secure the release of Trevor Reed, a former U.S. Marine who the State Department said was wrongfully imprisoned. In a call to Mr. Reed’s parents, an aide to Mr. Richardson said his boss was on a “guerrilla mission,” they would later recall.

Two months later, Mr. Reed was freed in a prisoner exchange with Russia, one that his parents said would not have been possible without Mr. Richardson’s help — even if it was unclear whether the garrulous politician had made a decisive difference, as opposed to quiet negotiations by the Biden administration.

Either way, the Russian mission was classic Bill Richardson. Until his death on Friday at age 75, Mr. Richardson cultivated a unique specialty in foreign affairs, positioning himself as an emissary — sometimes a secret one, and not always a welcome one for U.S. officials — to brutish foreign leaders whom American presidents and other officials would or could not deal with directly.

In a statement on Saturday, President Biden called Mr. Richardson’s work to help bring home dozens of imprisoned Americans “perhaps his most lasting legacy.”

It was a role for which Mr. Richardson was stylistically well-suited. He had a flair for flattery, as well as a quick, self-deprecating humor. Asked in a 2016 public appearance how he had become a middleman to strongmen, he smiled as he quoted what he said was President Bill Clinton’s answer to that question: “Bad people like him.”

Over several decades, beginning in the 1990s, Mr. Richardson became known as something of a dictator whisperer, meeting with the likes of Iraq’s Saddam Hussein, Cuba’s Fidel Castro and more than one member of North Korea’s ruling Kim dynasty. Several of his trips are widely credited with winning the freedom of detained Americans whose release had not been possible to secure through official channels, whether for practical or political reasons.

He took pride in knowing how to negotiate with prideful, sometimes murderous men, writing a book entitled “How to Sweet-Talk a Shark.” (“Respect the other side. Try to connect personally. Use sense of humor. Let the other side save face,” he once told an audience.)

Some U.S. officials have quietly complained in recent years that Mr. Richardson’s freelance bargaining, however well-intentioned, had complicated official negotiations to secure the release of American prisoners.

Operating from his nonprofit, the Richardson Center for Global Engagement — which, despite the impressive name, occupied a modest office space in downtown Santa Fe — Mr. Richardson also provided advice and emotional support for the families of Americans who experts say have been wrongfully detained by hostile governments in growing numbers.

He was drawn into the shadowy and often morally fraught world of prisoner diplomacy as a New Mexico congressman in 1994, after an Army helicopter pilot was downed and captured by North Korea after straying across the country’s demilitarized border zone on a training mission. The pilot was a constituent of Mr. Richardson’s, and the representative spent several days in Pyongyang securing his release, as well as the remains of his fallen co-pilot.

“I think the North Koreans were so sick of me, they gave me the pilots because they wanted me to leave,” Mr. Richardson later joked.

Mr. Clinton was impressed with his efforts and, in what Mr. Richardson called “a domino effect,” later sent Mr. Richardson on delicate missions to places like Afghanistan and Sudan.

A behind-the-scenes illustration of Mr. Richardson’s method can be found in a transcript of his July 1995 meeting in Baghdad with Mr. Hussein, whom he visited in a Clinton-approved effort to secure the release of two American prisoners. (The transcript is one of hundreds of Iraqi documents captured by U.S. forces years later and posted online by the Department of Defense.)

The transcript shows Mr. Richardson to be copiously respectful of the Iraqi leader, noting that he had voted against the 1991 congressional authorization for the American military operation to expel Iraq from Kuwait. He also jokes that Baghdad’s ferociously hot summer weather reminds him of his native New Mexico.

Mr. Richardson then tells the Iraqi leader, “If we want my mission to be successful, it has to be done in extreme secrecy.” He adds that, while he is not an official emissary of the Clinton administration, Mr. Clinton “is very much aware of my visit, as I have spoken with him about it many times.” Without mentioning specific concessions, Mr. Richardson makes clear that granting clemency for the two prisoners would “create an atmosphere of good will in the United States” for Mr. Hussein.

“I apologize if I took too long talking, even though I promised not to do so,” he concludes, joking that he had been compensating for his party’s minority status in Congress.

The pitch worked: Mr. Hussein agreed to let Mr. Richardson bring the prisoners home. In return, according to the Iraqi government transcript, Mr. Richardson left him with a piece of handcrafted New Mexican pottery.

Mr. Clinton, who nominated Mr. Richardson to be his ambassador to the United Nations the next year, said that he had “undertaken the toughest and most delicate diplomacy around the world,” and marveled that just a few days earlier, Mr. Richardson “was huddled in a rebel chieftain’s hut in Sudan, eating barbecued goat and negotiating the freedom of three hostages.”

After finishing his term as New Mexico governor and leaving the national political stage, Mr. Richardson resumed his focus on American hostages and prisoners abroad. But in recent years, his work became increasingly independent of the U.S. government. And his role in U.S. negotiations with countries like Iran (helping secure the release of Michael White, a Navy veteran, in 2020), Myanmar (helping negotiate the freedom of the U.S. journalist Danny Fenster in 2021) and Russia became a source of tension with both the Trump and the Biden administrations.

As in the case of Mr. Reed, Mr. Richardson met with Russians — including an oligarch close to Russian president Vladimir Putin — to craft a deal for the release of two other Americans detained in Russia, the W.N.B.A. star Brittney Griner and the former U.S. Marine Paul Whelan. Ms. Griner was released as part of a prisoner swap in December, though, once again, U.S. officials gave no indication that Mr. Richardson had played a decisive role.

Speaking to CNN last year, Mr. Richardson dismissed talk that his freelance diplomacy might complicate work through official channels

“There are a lot of nervous Nellies in the government that think they could know it all, and that’s not the case,” he said. “Look at my track record over 30 years.”