(CNN) -- Joaquin "El Chapo" Guzman had an assault rifle handy when authorities raided his beachside hideaway over the weekend, but the world's most wanted drug lord never opened fire.
That's because marines used infrared and body-heat scanners to pinpoint the locations of everyone inside the condo and make sure they were asleep, a Mexican official told CNN.
Saturday's pre-dawn operation that captured Guzman in the Mexican Pacific resort town of Mazatlan marked a dramatic twist in a case that has long captivated the country and frustrated investigators on both sides of the U.S.-Mexico border.
The notorious Sinaloa cartel leader's nickname, which means "Shorty," belies the tall and near-mythic status Guzman achieved in recent years for his ability to elude capture by using bribes, safe houses and an army of cartel helpers.
His 13 years on the lam ended Saturday inside a no-frills condo tower, where investigators found Guzman lying shirtless next to his beauty-queen wife.
The Mexican official, who asked not to be identified because he's not authorized to speak publicly about the case, said that Guzman's body guard and the drug lord's 2-year-old twin daughters were also sleeping in the condo.
"He had an AK-47 next to the bed. When the Mexican marines entered the condominium, he was still asleep," said Michael Vigil, a former Drug Enforcement Administration official who says he was briefed on the raid. "They used the element of surprise, and he did not have a chance to react and seize his weapon."
Escape through sewer tunnels
Guzman had an assault rifle and ammunition close by when Mexican marines broke into the apartment in a "surgical" operation, the Mexican official said.
Authorities had been closing in on Guzman for months before Mexican marines swooped in, 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.
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.
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.
Mario Hidalgo Arguello, a courier who flipped during questioning by Mexican authorities, told interrogators about the series of safe houses, according to U.S. officials familiar with the hunt for Guzman.
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 house's reinforced steel doors was enough to allow Guzman to escape via a hidden hatch under a bathtub, the officials said.
"But the investigation was so thorough that we continued," Murillo said.
With authorities temporarily off his trail, Guzman slipped out of Culiacan through the sewer tunnels, the Mexican official told CNN. Eventually he made his way to Mazatlan, a beach resort city about 125 miles (200 km) away.
Informants and wiretaps
Months before authorities nabbed him there, U.S. authorities made a major break in the case.
In November, they arrested 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.
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 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 had met with other foreign ministers from across the hemisphere in the same resort town.
Last year, Guatemalan authorities said a man who resembled Guzman died in Peten, Guatemala, during a shootout. Later, they changed their story and said Guzman 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.
Last year, authorities arrested Guzman's father-in-law in Sonora, Mexico, charging him with drug-related crimes.
But not all of the focus on Guzman's family has been tied to organized crime.
In September 2011, word eked out that Guzman's beauty-queen wife, Emma Coronel -- a citizen of both the United States and Mexico -- had given birth to twin girls at a hospital in Lancaster, California.
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.
Her attorneys said she was pregnant and had been coming to the United States to have a baby.
CNN's Nick Parker, Ray Sanchez, Mike Martinez and CNNMexico.com contributed to this report.