Authorities had been closing in on the notorious Sinaloa cartel leader for months before Mexican marines swooped in Saturday, Mexican Attorney General Jesus Murillo Karam told reporters.

Earlier police operations yielded a trove of intelligence, including cell phone and other data, a U.S. law enforcement official said. That helped Mexican authorities and U.S. Drug Enforcement Administration agents hunting Guzman gain confidence in recent weeks that they could arrest him.

A key discovery earlier this month marked a turning point in the investigation: seven houses in the Mexican city of Culiacan, connected by secret tunnels that also tied in with the city’s sewage system.

Investigators almost caught him then, Murillo said, but reinforced steel doors made it too tough for them to enter the compound quickly.

“It made it so that in the minutes we took to open them, he escaped in the tunnels,” Murillo said. “But the investigation was so thorough that we continued.”

Before Guzman’s capture, Mexican federal forces made several significant arrests of Sinaloa cartel associates, including two people authorities said were suspected of providing security for top leaders of the cartel.

Informants and wiretaps

Among the major breaks was one in November, when U.S. authorities nabbed Serafin Zambada-Ortiz at the Nogales, Arizona, border crossing. He is the son of Guzman’s closest lieutenant, Ismael “El Mayo” Zambada, likely the Sinaloa chief’s heir apparent.

The arrests intensified in recent months, with each providing phones that led to a trove of new data that helped map associates in ever-closer touch with Guzman, U.S. officials familiar with the hunt said.

Mexican authorities picked up Mario Hidalgo Arguello, a courier who flipped during questioning, the officials said. He told interrogators about a series of safe houses, they said, each with reinforced steel doors and escape hatches that led to tunnels.

When authorities raided one of them last week, it turned out to be Guzman’s main residence in the town of Culiacan. The time it took Mexican marines to get past the steel door was enough to allow Guzman to escape via a hidden hatch under a bathtub, the officials said.

Agents from the DEA, Immigration and Customs Enforcement, and the U.S. Marshals Service have fed intelligence gleaned from wiretaps and informants to Mexican authorities for years.

Each cell phone led to dozens of others over time. “It went from phone to phone, just basic law enforcement,” one of the U.S. officials said.

In recent months, investigators focused on five wiretaps — four operated by the DEA and one by ICE, which yielded valuable intelligence, the officials said. As the hunt intensified, Guzman and his lieutenants stopped using certain phones, apparently aware of the surveillance. In the final days, the ICE wiretap was the only one still producing activity, the officials said.

Captured alongside Guzman was Carlos Manuel Hoo-Ramirez, who U.S. authorities say appeared to serve as “El Chapo’s” communications conduit. He carried multiple phones that proved crucial to finding the drug boss, the officials said.

Hunt marked by rumors, close calls

Ever since his escape in a laundry cart from Mexico’s Puente Grande prison in 2001, the hunt for Guzman has grabbed headlines.

During the drug lord’s nearly 13 years on the lam, rumors swirled about his whereabouts.

From time to time, investigators suggested they were hot on his trail. But even as Mexico stepped up its pressure on cartels, he remained an elusive target. Many in the country suggested that his whereabouts were an open secret — and that the government must have been deliberately steering clear of capturing him.

In 2009, the archbishop of Mexico’s Durango state told reporters that Guzman lived near the mountain town of Guanacevi.

“Everyone knows it, except the authorities,” he said.

Days later, investigators found the bodies of two slain army lieutenants in Durango’s mountains, accompanied by a note: “Neither the government nor priests can handle El Chapo.”

A year later, when asked by reporters again about El Guzman’s whereabouts, the archbishop said, “He is omnipresent. … He is everywhere.”

In 2012, a Mexican official told the Associated Press that authorities nearly caught Guzman in a raid on a beach mansion in Cabo San Lucas, Mexico, barely a day after Hillary Clinton was meeting with other foreign ministers from across the hemisphere in the same resort town.

Last year, Guatemalan authorities said a man who resembled El Chapo died in Peten, Guatemala, during a shootout. Later, they changed their story and said El Chapo wasn’t killed and the shootout may never even have happened.

Family still in spotlight

While Guzman managed to avoid authorities’ attention, the wrath of his rivals and the media’s glare, other members of his family weren’t so lucky.

Authorities arrested Guzman’s brother, known as “El Pollo” (The Chicken), in Mexico City in September 2001. Three years later, he was shot to death by a fellow inmate in a maximum-security prison.

Legend has it that “El Chapo” Guzman was also once arrested in Mexico’s capital, according to an account in Malcolm Beith’s book “The Last Narco: Inside the Hunt for El Chapo, the World’s Most Wanted Drug Lord.”

“At the police station, he lifted up a suitcase and put it on the desk of the capital’s chief of police,” Beith writes. “Inside was $50,000 in cash; within minutes, Chapo was out the door.”

Members of a rival cartel gunned down Edgar Beltran Guzman, one of El Chapo’s sons, in a Mexican shopping mall parking lot in 2008. Police found more than 500 bullet casings at the scene.

About a year later, authorities arrested Alejandrina Gisselle Guzman Salazar, one of El Chapo’s daughters, at a border crossing in San Ysidro, California. She was deported back to Mexico several months later.