The headquarters of the KGB, in Moscow, in 1972. Gen. Yuri Drozdov led the spy agency’s “illegals” program in the final years of the Cold War. (AP)

They were known as the illegals, men and women who adopted the identities of the dead, worked as priests, poets, actors and inventors, and quietly gathered intelligence for the Soviet Union during the long years of the Cold War.

Based in nondescript American suburbs and bustling European capitals, they spent up to two decades developing the trust of their neighbors and employers while stealing secret information about nuclear weapons, missile systems, Western intelligence efforts and political intrigue.

At the helm of their organization, a secretive wing of the KGB known as Directorate S, was a balding man with the rank of major general and the name of Yuri Drozdov. A square-jawed World War II veteran who led assaults in Afghanistan and helped arrange a high-profile spy exchange in 1960s Berlin, he died June 21 at 91.

The Foreign Intelligence Service, a KGB successor agency known as the SVR, announced his death but did not provide additional details.

Gen. Drozdov oversaw the KGB’s illegals program — its name distinguished it from the agency’s “legal” spy program, in which agents maintained diplomatic connections to the Soviet motherland — from 1979 until 1991, shortly before the dissolution of the Soviet Union. It was the capstone of an intelligence career that spanned nearly the entire Cold War, from a stint on the “bridge of spies” in Berlin to an undercover position in China at the start of Mao Zedong’s bloody Cultural Revolution.

The Soviet spy Rudolf Abel, who was convicted of espionage charges in the United States in 1957. Gen. Drozdov helped arrange his return to the Soviet Union in exchange for downed American spy-plane pilot Francis Gary Powers. (AP)

Yet despite spending much of his career behind the scenes, Gen. Drozdov was not afraid to involve himself in “wet affairs,” the euphemistic KGB term for assassinations, beatings, poison-tipped umbrella murders and similar acts of hand-dirtying.

It was Gen. Drozdov who led KGB forces in the December 1979 assault on the palace of Afghan President Hafizullah Amin, a 43-minute surprise attack that resulted in Amin’s death and launched a Soviet invasion of the country. The operation resulted in the deaths of 55 Soviet operatives, 37 of them from an aircraft crash, and of 180 Afghans, according to an account by Jonathan Haslam, a historian of the Soviet Union’s foreign policy and intelligence efforts. One Russian leader later described the attack as “perfect” and “absolutely unprecedented.”

Several days after the battle, Gen. Drozdov recommended that then-KGB leader Yuri Andropov create a new special-forces unit within the agency, allowing it to professionalize its wet-affairs operations. Known by the name Vympel (“pennant”), the new unit was formally created under Gen. Drozdov in 1981 and went on to perform operations in Afghanistan and Chechnya.

Gen. Drozdov focused mainly on the illegals program in later years, identifying recruits (“wunderkinds,” he called them) capable of excelling in the program’s years-long training regimen. “We have our process of raising them,” he told the New York Times in 2010, declining to provide additional details. “You have your Dr. Spock method; we have our own ways.”

Jason Matthews, a former CIA officer in Europe and Asia who writes espionage thrillers, said the illegals program was similar to that of the cable television hit “The Americans.” KGB leaders such as Gen. Drozdov would develop fictional identities known as “legends” for each illegal and scour cemeteries to find the names of dead children whose birth years closely matched those of the agents. Some agents were assigned official wives to help them blend in.

The technique was time-consuming and not always productive, Matthews said, and for those reasons was not used by the CIA. “Can you imagine the director of PR telling any Western officer, ‘You’ve got to go to China and live with a wife we’ve selected for you for 20 years?’ ”

Still, undercover illegals have been discovered in the United States as recently as June 2010, when 10 alleged spies were arrested by the FBI in Boston, New York, New Jersey and Arlington, Va. Six of the spies were using the names of dead people, and all 10 were sent to Russia later that year, in a spy swap for four Russians convicted of aiding the West.

Yuri Ivanovich Drozdov was born in Minsk on Sept. 19, 1925. Details on his early life are vague. According to Haslam’s book “Near and Distant Neighbors: A New History of Soviet Intelligence,” his father at one time served in the tsarist army, and Gen. Drozdov served in the Russian army at the close of World War II.

He joined the KGB in 1956 and was initially based in East Germany, where he refined his language skills and claimed to have studied at a theater school “to learn the art of impersonation.”

Gen. Drozdov played a minor role arranging the 1962 trade of Francis Gary Powers, a downed American spy-plane pilot, for convicted Soviet spy Rudolf Abel, a member of the illegals program who had purportedly stolen nuclear secrets from the United States. In a scene that inspired Steven Spielberg’s 2015 film “Bridge of Spies,” Gen. Drozdov stood on a bridge between Berlin and East Germany as Abel returned to the Soviet-controlled side.

Gen. Drozdov came to the United States in 1975, where he took charge of the Soviet intelligence station in New York before being named head of Directorate S. He seemed to retain a fondness for Americans, with whom he collaborated in business partnerships after the fall of the Soviet Union.

His company, Namacon (sometimes spelled Namakon), provided political analysis. At one point it also manufactured airplane tires before seeming to find a niche at finding office space and performing background checks for Western businesses in Russia.

Skills he learned as a spy sometimes came in handy. “In my KGB career I had much experience at getting enemies to do my will,” he told Forbes magazine in 1994, “and I thought this would be very useful in business.”