Gerald Shur was 15 when he first met a mobster, a bodyguard for a racketeer seeking to intimidate his father, a dressmaker in New York City’s garment district. “My father hated the mob and what it did in a community,” Mr. Shur recalled years later. His anger, he said, was “the fuel that fed my fire.”

As a young lawyer in 1961, Mr. Shur landed a job with the Justice Department under Attorney General Robert F. Kennedy. Kennedy described the world of organized crime as a “private government . . . with an annual income of billions, resting on a base of human suffering and moral corrosion,” and he trained the Department’s prosecutorial power on breaking the mob in the United States.

Assigned to the organized crime and racketeering section in New York, Mr. Shur discovered the value of firsthand testimony about mob activities — and the mortal threat that faced witnesses who came forward to offer it. To punish one informant who wore a wire for the FBI, Mr. Shur told the Associated Press, the man’s “killers jammed wires through his head and tortured him with a cattle prod.”

The “key to nabbing the big guns,” Mr. Shur concluded, was to guarantee the safety of insiders who agreed to testify against them. To that end, he founded the federal witness protection program, which spirits away witnesses whose lives are in danger and furnishes them with new identities to prevent pursuers from ever tracking them down.

“There was no model for it,” he told NPR. “I had to make it up as I went along.”

Amid acclaim and sometimes criticism, the Witness Security Program, or WITSEC, as it is officially known, has provided security for 8,600 witnesses and 9,900 members of their families since it became operational in 1971, according to the U.S. Marshals Service, which administers the highly secretive program.

Along with the Racketeer Influenced and Corrupt Organization (RICO) Act of 1970, the witness protection program has been credited with helping secure thousands of convictions in organized crime, drug trafficking, terrorism and other major criminal cases, with Mr. Shur as a key figure behind its operation.

“No witnesses got protection without his personal attention,” Pete Earley, co-author with Mr. Shur of the book “WITSEC: Inside the Federal Witness Protection Program” (2002), wrote in a tribute to Mr. Shur.

“He wrote nearly all of the program’s rules, shaped it based on his own personal philosophical views, and guided it with an iron hand. He helped create false backgrounds, arranged secret weddings, oversaw funerals. He personally persuaded corporate executives to hire a mafia hit man as a delivery route driver, once arranged for the wife of a Los Angeles killer to have breast enlargement surgery to keep her husband happy, and got the government to pay for a penile implant for one mobster turned witness after he became depressed.

“In return,” Earley continued, “WITSEC witnesses helped topple the heads of every major crime family in every major city, helping send ten thousand criminals to prison because of their testimonies.”

Mr. Shur, a recipient of the John Marshall Award, one of the highest honors bestowed by the Justice Department, died Aug. 25 at his home in Warminster, Pa. He was 86 and had complications of lung cancer, said his son, Ronald Shur.

The intrigue of entering the witness protection program has fired the imaginations of crime novelists, filmmakers and even some prospective witnesses, who might see it as a means of making a clean break from their former lives. But the reality of life in witness protection is often much bleaker, as Mr. Shur readily conceded.

“When you assume a new identity, you may never return to your past life,” he told the Philadelphia Inquirer. “You basically forfeit your chance to attend your mother’s funeral.”

Protected witnesses receive new names — although many keep their first names, to avoid slip-ups — and new Social Security numbers, as well as doctored school and employment records. Many protected witnesses have engaged in criminal activity in their previous lives, creating quandaries for marshals who seek to place them in new jobs.

“You don’t put a counterfeiter in a print shop or a hijacker in a truck,” Mr. Shur wryly told the Boston Globe. “You try to put the counterfeiter in the truck.”

All manner of complications arise, such as the request of one witness, Mr. Shur recalled, to be relocated with his mistress rather than his wife or the teenager who threatened to blow his father’s cover if the father didn’t buy him a car.

There is profound sadness, as well, such as the trauma suffered by a young child who had just begun to say his name when he was forced to learn a new one, and the grief of grandparents who can no longer see their relocated grandchildren.

According to the Marshals Service, no protected witness, “following program guidelines, has been harmed or killed while under the active protection of the U.S. Marshals Service.” But for some participants, the emotional burden of abandoning their families, friends, communities, livelihoods and lives is too onerous. “One fellow went back home, turned his doorknob and it blew up in his face,” Mr. Shur told the Associated Press.

One of the most famous mobsters to enter witness protection was Henry Hill, the Lucchese family Mafioso whose story was dramatized in Martin Scorsese’s movie “GoodFellas” (1990). (Hill ultimately left the program and died in 2012.)

Much of the controversy surrounding WITSEC stemmed from the perceived protection that it offered alleged or convicted criminals — often the witnesses able to provide the most damning evidence in court — who were placed in unsuspecting communities. In one notorious case, Marion Albert Pruett, who described himself as a “mad dog killer,” was convicted of killing five people, including his wife, in 1981 while enrolled in the program.

In 1984, Congress passed the Witness Security Reform Act, which, among its provisions, placed greater constraints on who could enter the program, required it to allow noncustodial parents to visit their relocated children, and prohibited the program from protecting witnesses from their creditors.

Mr. Shur contended that cases such as Pruett’s were the exception, citing a recidivism rate among participants that was considerably lower than the rate among former prisoners. Defenders of the program noted that witnesses were not spared prison sentences for their own crimes, and indeed received protection while they were incarcerated.

The prosecutorial value of the program was undisputed.

“It was indispensable,” Andrew Weissmann, a former Justice Department official who prosecuted numerous members of the Colombo, Gambino and Genovese crime families in the 1990s, said in an interview.

“You needed to have cooperating witnesses, insiders who literally could tell you where the bodies were buried. It’s hard enough to convince them to cooperate, but it’s impossible if you can’t ensure their safety and the safety of their families.”

“That’s what the witness protection program provided,” he continued. “In terms of its ability to make a community safer, it was really a giant step forward.”

Gerald Shur was born on Oct. 18, 1933, to a Jewish family in the Bronx. His father was born in what is now Belarus, and his mother’s family immigrated to the United States from Latvia.

At the University of Texas at Austin, he received a bachelor’s degree in business administration in 1955 and a law degree in 1957.

Mr. Shur spent more than 30 years with the Justice Department before his retirement in 1995. Among the last informants Mr. Shur handled, according to Earley, was Salvatore “Sammy the Bull” Gravano, the underboss of the Gambino crime family, who became a government informant and helped end the reign of John J. Gotti. Gravano ultimately left the program and was released from prison in 2017 after being convicted on an array of drug charges.

Mr. Shur was a longtime resident of Bowie, Md., before he and his wife moved to Annapolis, where they lived for nine years on a 42-foot boat, and then to Pennsylvania. In addition to his wife of 68 years, the former Miriam Heifetz of Warminster, survivors include two children, Ilene Meckley Clark of Boynton Beach, Fla., and Ronald Shur of Philadelphia; a brother; a half-sister; six grandchildren; and seven great-grandchildren.

Mr. Shur objected to the characterization of the witnesses in his program as “snitches.”

“That’s a word that I always tell people not to use in front of me,” he told the online magazine Salon. “These people are finally doing the right thing. They’re cooperating.”