An official who spoke on condition of anonymity because he was not authorized to be quoted by name said Guzman was apprehended after a shootout with Mexican marines in the city of Los Mochis, in Guzman’s home state of Sinaloa.

Responding to what was seen as one of the biggest embarrassments of his administration — Guzman’s July 11 escape through a tunnel from Mexico’s highest-security prison — Pena Nieto wrote in his Twitter account on Friday: “mission accomplished: we have him.”

Five people have been killed and one Mexican marine wounded in the clash.

The Mexican Navy said in a statement that marines acting on a tip raided a home in the town of Los Mochis before dawn. They were fired on from inside the structure. Five suspects were killed and six others arrested. The marine’s injuries were not life-threatening.

At the home marines seized two armored vehicles, eight long guns, one handgun and a rocket-propelled grenade launcher.

“The capture of Joaquin ‘Chapo’ Guzman-Loera is a victory for the rule of law and the Mexican people and government. The arrest is a significant achievement in our shared fight against transnational organized crime, violence, and drug trafficking,” the DEA said in statement.

“It is further evidence of our two countries’ resolve to ensure justice is served for families who have been plagued by Guzman-Loera’s ruthless acts of violence. The DEA and Mexico have a strong partnership and we will continue to support Mexico in its efforts to improve security for its citizens and continue to work together to respond to the evolving threats posed by transnational criminal organizations,” it said.

Just days ago, U.S. law enforcement officials predicted drug lord Joaquin “El Chapo” Guzman capture was imminent, seven months after his spectacular escape from Mexico’s only Supermax prison.

Guzman’s escape through a professionally excavated tunnel in July did not come as a complete surprise to U.S. Drug Enforcement Administration agents. The drug trafficking kingpin is a folk hero in Mexico, with a vast support network and enormous wealth to buy off prison guards and other local officials, and his Sinaloa Cartel is infamous for using sophisticated drug-running tunnels under the U.S. border.

The escape of El Chapo — a nickname meaning “the short one” or “shorty,” which the vicious and deadly criminal acquired because of his 5-foot-6-inch stature — was galling for law enforcement officials on both sides of the border, who have made it a point of pride to recapture him.

The Sinaloa Cartel runs a multibillion-dollar criminal enterprise that reigns as the top supplier of illegal drugs, including heroin, cocaine, marijuana and methamphetamine, throughout the United States. Its drug trafficking operations reach from the Americas around the globe, to Europe, the Middle East, Southeast Asia and Australia.

Guzman and his cartel hit men have been linked to thousands of killings, mostly in Mexico.

But El Chapo has cultivated a reputation as a Robin Hood-like figure who has spent some of his ill-gotten fortune to build schools and roads in Sinaloa, the impoverished region in northwestern Mexico were he grew up.

U.S. agents, who are strictly prohibited from discussing Guzman because of the delicate relationship with Mexico in fighting the drug war, privately express confidence that he will be captured or killed in a shootout with police within the next year or two.

“He’s getting old, and he’s getting sloppy. Everyone is looking for him, and we’ll get him again,” said a DEA analyst, who brimmed with anger at the mere mention of El Chapo.

After his 1993 capture in Guatemala and extradition to Mexico to face murder and drug trafficking charges, Guzman escaped in 2001 by hiding in a laundry cart and bribing prison guards.

Mexico’s elite navy strike force, similar to the U.S. Navy SEALs, recaptured Guzman in February 2014 and took him alive as his beauty queen wife begged the troops to spare his life, according to reports.

Less than a year later, Guzman slipped into a 20-inch-square opening cut through the floor of the shower stall in his jail cell and into a tunnel that led to a small cinder-block house in an open field about a mile from the prison.

The tunnel was about 30 inches wide, shored up with gray stone walls and equipped with fluorescent lights hung from a ceiling-mounted PVC pipe, which also supplied fresh air.

Metal tracks were bolted to the floor for a small railcar powered by a motorcycle engine, a car that whisked Guzman through the tunnel to freedom.

In October, an unedited video of Guzman’s escape leaked, shedding more light on the suspicious circumstances surrounding the prison break.

Mexican television channel Televisa broadcast the closed-circuit TV footage of Guzman’s escape, the longer version of a video that authorities had released but without sound and showing only the moments before Guzman disappeared.

“It’s obviously very embarrassing that somebody could build a tunnel a mile long, 30 feet underground and hit a 2-foot-by-2-foot shower stall. Obviously, there is corruption involved,” said Carl Pike, who was assistant special agent in charge of the DEA’s Special Operations Division for the Americas until he retired last year.

Inside help?

News reports have suggested widespread collusion between Mexican federal forces and the Sinaloa Cartel, as well as cases of U.S. federal agents bought off and assisting the drug smugglers.

Still, Mr. Pike said, the corruption angle had been overplayed.

“Corruption is involved everywhere,” said Mr. Pike. “It is corrupt in Mexico. But we have corruption here in the U.S. We have corruption pretty much everywhere we go.”

Mexican authorities have arrested more than 30 people, including prison officials, on charges of helping Guzman escape.

Mexico Attorney General Arely Gomez Gonzalez confirmed to the Mexican newspaper Milenio that “very large sums of money” had changed hands in the escape.

“The exact amount of how much was spent has not been fully documented, but we know it is a very large sum of money,” said Ms. Gomez Gonzalez. “But we have not exhausted this investigation, and we continue to work on other matters relating to the same subject.”

Nevertheless, Mr. Pike praised the integrity of his counterparts in Mexico, especially the naval special forces, saying he had 100 percent confidence that they were doing everything possible to track down and capture Guzman.

“They want to show the world that they are the same great power that caught him the first time, and they’ll catch him again,” Mr. Pike said.

He predicted that Guzman would be apprehended within two years and was likely holed up in Mexico or perhaps in Venezuela, where the Sinaloa Cartel has a base of operations and the U.S. has limited influence.

The former agent said a move by navy special forces to crack down on Guzman’s hometown of La Tuna was a promising development.

After a recent clash between rival factions within the cartel near La Tuna left at least eight dead, about a dozen Mexican navy special forces troops raided the town.

The troops stopped all travel in and out of the town for several days and seized the ranch of Guzman’s brother, Aureliano, another top figure in the cartel, according to Mexican news reports.

Guzman’s mother, Consuelo Loera, and various family members still live in La Tuna.

“That’s putting pressure on Chapo and putting pressure on the whole cartel,” Mr. Pike said. “It will get to a point where people will say, ‘Hey, I’m glad he built the school, I’m glad he built the road, but I’m tired of getting stopped and searched every time I go to the store to buy milk or every time I go to church there’s a checkpoint, and I have to tell them who I am and where I live.’

“You put that kind of pressure on an area, and somebody eventually is going to say, ‘OK, he’s down the street. Just to make all this go away, go get him,’” he said. “So I think it is really good. It’s a good move.”

Like other DEA agents who have been involved in the hunt for Guzman, Mr. Pike was irked by criticism that too many resources were being devoted to the pursuit of a single man whose capture will likely not interrupt the Sinaloa Cartel’s drug-smuggling operations.

“People say, ‘What difference does it make?’ Well, it might not make a difference in the actual control of drugs, but it sends a statement that we — the good people — are going to come get you, and we’re going to exhaust everything we can until we do so,” he said.

“Is that going to be a deterrent to somebody? Hopefully. Maybe it will,” he said. “I think they’ll get him again. Chapo is great at escaping, but he really sucks at not getting caught. We got him twice. We’ll catch him again.”