MIAMI—Manuel Rocha was on alert, zigzagging through Miami’s Brickell district, en route to a clandestine meeting—at a church.

The retired U.S. ambassador was fearful of being tailed. But “a message for you from your friends in Havana” was waiting, promised a text from the man who had requested the covert encounter, according to a federal criminal complaint.

The urbane and self-assured Rocha failed to detect counterintelligence agents from the Federal Bureau of Investigation who were watching and following.

The FBI arrested Rocha in December , and U.S. prosecutors allege he secretly pushed Cuba’s agenda for more than 40 years as he advanced through top posts at the State Department, National Security Council and the U.S. military’s Southern Command. Rocha told a federal judge last month that he intends to plead guilty to being an agent of Cuba.

Attorney General Merrick Garland called the Rocha case one of the “highest-reaching and longest-lasting infiltrations of the U.S. government by a foreign agent” of any country.

The Rocha affair, just one in a string of cases in which Americans accused of spying for Havana have penetrated virtually every segment of the U.S. national security structure, points to a larger problem, former U.S. and Cuban intelligence officers say. Cuba and its intelligence service, the Dirección de Inteligencia, are in the world’s top ranks when it comes to recruiting spies, while the American teams responsible for stopping them are understaffed and outmatched, according to former U.S. counterintelligence officials.

Cuba has “the best damn intelligence service in the world” for cultivating agents, said Brian Latell, a former CIA analyst who led the agency’s Latin America division.

And the implications of that espionage extend beyond Cuba. Former U.S. officials say Washington has repeatedly underestimated the danger from Havana, which often distributes the fruits of its spying to more potent adversaries such as Russia and China.

The Justice Department said that Cuba “has long posed a significant counterintelligence threat to the United States,” citing its relationship with U.S. rivals.

The Cuban Embassy in Washington didn’t respond to a request for comment.

‘Sinister genius’

Modeled on the Soviet KGB and its Eastern bloc cousins, Cuba’s spy service still relies on time-tested Cold War spy tradecraft, such as high-frequency shortwave radio transmissions to communicate with agents, and one-time cipher pads to encode and decode messages. What it lacked in high tech it made up for in human capital.

“One of the reasons they were so good is they had a sinister genius running their service, the president of Cuba,” Latell said, referring to Fidel Castro .

The office of Raúl Castro, Fidel’s brother and Cuba’s former longtime military chief, would receive stacks of original U.S. government documents from moles at the State Department, Pentagon and elsewhere, Alcibíades Hidalgo, Raúl Castro’s chief of staff for 12 years, said in an interview with The Wall Street Journal. “We didn’t have the capacity to go through them all.”

The haul was sometimes momentous, and included stolen American high tech and intended targets of U.S. military plans. Other times it was mundane, such as one CIA report detailing how a Brazilian president had died after doctors misdiagnosed his ailment, diverticulitis. Hidalgo said Raúl told him to flag anything else about the disease: “Fidel suffers from this.”

Cuba recruited Americans, in part, by looking for potential sympathizers . Cuban intelligence officers routinely target young people, often in academia, with an ideological pitch about Cuba suffering under the U.S. economic embargo and other policies, current and former officials say.

“The Cubans didn’t pay big and didn’t need to pay big,” said Stuart Hoyt Jr., a former FBI agent who worked Cuban counterintelligence cases. “Because they could find people that sympathize.”

Ana Belén Montes, a senior Defense Intelligence Agency analyst considered Havana’s most damaging spy in the U.S. government, was recruited by Cuban intelligence while a student. She rose through the ranks to become one of U.S. intelligence’s top Cuba specialists. She pleaded guilty in 2002 to spying and served two decades in prison.

Montes, who spied undetected for Cuba for 17 years, told Havana about a stealth spy satellite program code-named Misty, information of more utility to Russia and China than Cuba, according to Jim Popkin, author of a book on the Montes case.

José Cohen Valdés, a former Cuban cryptography officer who defected on a raft in 1994, said that when intelligence would come in, Havana would categorize it to determine what was useful for its own purposes, and what might help other countries.

“All agents who work for Cuba indirectly work for governments that are hostile to the U.S.,” he said in an interview with the Journal.

65-Junk

When it came to recruiting agents, Cuba’s spies always had one major advantage over their American counterparts. Havana’s spy priority has always been the U.S., while Cuba is often an afterthought for Washington.

The FBI’s New York field office recently had 12 counterintelligence squads dedicated to Russia, but just one for Cuba, said Chris Simmons, who worked Cuban counterintelligence cases at the DIA.

“There was a revolving door at Cuban counterintelligence; everybody wanted to get out,” said Peter Lapp, a former FBI agent who investigated Montes and wrote a book about the case.

The FBI’s label for Cuban spy cases was 65J, but agents called it “65-Junk,” Lapp said.

If the FBI failed to identify agents spying on the U.S., the CIA had its own problems penetrating Cuba. In 1987, a Cuban military officer—code-named “Touchdown” by the CIA—defected while serving in Eastern Europe. Cuban Maj. Florentino Aspillaga Lombard told his stunned American handlers that all but one of the four dozen agents the CIA was running in Cuba was a “double,” secretly under the Castro regime’s control. The revelation chilled CIA recruiting efforts in Cuba for years, officials said.

Cuban media reported that one of the doubles had received a CIA award, according to Latell. “The CIA didn’t suspect a thing,” he said.

Cuba, meanwhile, was busy running agents who secured jobs at U.S. military bases with false identities under a program code-named “Operation Texaco,” according to a former federal prosecutor and judge. Havana also penetrated exile groups in South Florida and participated in the downing of a private flight operated by an anti-Castro group, killing four people.

In the early 2000s, U.S. counterintelligence services knew of more than 100 actual or potential Cuban agents in the U.S., according to Lapp, yet failed to allocate requisite manpower to investigate them.

Former U.S. and Cuban officials suspect that Havana still runs agents within the U.S. government and society, based on defector accounts, intercepted communications and Cuban tradecraft.

Grand slam

The government believes that Cuba recruited Rocha, a naturalized U.S. citizen from Colombia, during his stay as a student in Chile in 1973. He fit a mold familiar to Fidel Castro, who took special interest in U.S. officials of Hispanic background who might be sympathetic to Havana, said a former Cuban intelligence officer who defected to the U.S.

US ambassador to Bolivia, Manuel Rocha, talks to the press 11 July 2001. AFP/PHOTO Gonzalo ESPINOZA (Photo by GONZALO ESPINOZA / AFP)/ VISUAL HELLAS

Rocha, who became a “great friend” of Cuban intelligence, according to the criminal complaint, joined the State Department in 1981 and worked at U.S. embassies in Bolivia, the Dominican Republic, Honduras and Mexico. “You just cringe when you think of the amount of high-level information that he had,” said Evan Ellis, a Latin America expert at the U.S. Army War College.

After retiring from the State Department in 2002, Rocha joined several boards and businesses. He advised the U.S. military’s Southern Command, which oversees U.S. operations and security in Latin America, where he continued to access sensitive information and maintain contact with Cuban intelligence, the Justice Department alleges.

Publicly, it is unknown if the U.S. suspected Rocha of Cuban ties while he served in government. He was almost certainly identified by either a Cuban defector or in coded communications the U.S. intercepted, according to former American officials.

In late 2022, an undercover FBI counterintelligence agent posing as a Cuban intelligence official contacted him by text message. In three Miami-area meetings in a year-plus, Rocha boasted of his success in penetrating the State Department, according to the criminal complaint.

U.S. officials “underestimated what we could do to them,” Rocha said in one of the meetings, according to a government affidavit. His collaboration with Cuban intelligence, he said, was “more than a grand slam.”

Write to Brett Forrest at brett.forrest@wsj.com and Warren P. Strobel at Warren.Strobel@wsj.com