On the first night of May 2011, two Black Hawk helicopters took off from Afghanistan on a top-secret mission to kill or capture Osama bin Laden. The Black Hawks, which had been modified to disguise their heat signatures and mask them from radar, were bound for Abbottabad, Pakistan, where bin Laden was suspected of hiding. The crew included 23 members of the Navy’s elite SEAL Team Six, members of the Army’s select Night Stalkers regiment, and a dog named Cairo.

It was a dark, moonless evening—“low loom,” in military parlance. Cairo, a seventy-pound Belgian Malinois, sat on the floor of the second chopper, huddled among eleven SEALs and an interpreter. He likely wore a lightweight tactical vest made with dual Kevlar panels, which were designed to withstand everything from knife attacks to shrapnel, and an infrared camera that could transmit images back to his handler. All told, he probably carried more than $20,000 worth of gear.

His skills and intelligence, however, were what made him indispensable to the mission. Cairo was trained to fill any number of roles. The first would be to stand guard outside the compound, alerting the soldiers to anyone who approached. If a crowd gathered, he could help keep the locals at bay. Inside the compound walls, Cairo could sniff out bombs or booby traps; he could even help locate bin Laden, in the event he was hiding in a spider hole or some other secret area. If someone in the house tried to escape, Cairo could chase him down, utilizing his speed (twice that of a human’s) and strength (a bite pressure of seven hundred pounds per square inch). In the most extreme scenario, he might even be used to take down bin Laden, attacking without hesitation on a simple command: “Get ’im!”

According to the mission, Cairo’s helicopter was supposed to hover over one corner of the compound as a few SEALs rappelled to the ground, with Cairo strapped to his handler’s chest. But things in the military seldom go according to plan. The first chopper spun out of control and had to ditch, so the second chopper’s pilot landed in a field across the street. Cairo and four of the SEALs quickly set up a perimeter, and the rest of the team stormed the compound. Thirty-eight minutes later, bin Laden was dead, and Cairo and the SEALs were on their way back home.

In the celebratory days that followed, the members of SEAL Team Six were hailed as national heroes. President Obama met them at a Kentucky Army base, where he presented them with a special citation. He shook their hands and thanked them for their service. But there was one member of the group he inquired about specifically.

“I want to meet that dog,” Obama said.

For almost as long as there has been war, there have been war dogs. The ancient Romans used to arm their dogs with chain mail and spiked collars. The ancient Britons used mastiffs to defend against those Romans. Napoleon stationed guard dogs at the gates of Alexandria. The Germans ushered in the modern era of war dogs, establishing the first dog-training school in the thirties. Even in today’s high-tech military, with its biometric imaging and laser-equipped Predator drones, there’s still no substitute for a well-trained dog, and since 9/11, the number of military dogs deployed in the field has more than doubled. The United States currently has 2,800 dogs deployed worldwide, more than any other country. General David Petraeus, the former commander of U.S. forces in Afghanistan, has summed it up this way: “The capability [dogs] bring to the fight cannot be replicated by man or machine.”

Half a world away from Abbottabad, on more than nine thousand acres in southwest San Antonio, Lackland Air Force Base has established itself as the largest military dog school in the world. Lackland is the home of the 341st Training Squadron, a.k.a. the Military Working Dog Program. Since its inception, in 1958, the program has trained tens of thousands of dogs. At any given moment, roughly eight hundred dogs are stationed here, undergoing the equivalent of canine basic training.

In the predawn darkness earlier this summer, I met Master Sergeant Rick Reidel, who supervises Lackland’s dog program, in a dusty field near an old munitions dump. Because of the intense Texas heat, dog training often starts before dawn and usually finishes by ten o’clock. A dozen dogs were leashed among the oak trees, drinking water from gallon jugs; there was also an air-conditioned trailer idling nearby. In the distance, you could hear dogs barking back at the kennels, hungry for their breakfast.

The dogs at Lackland (Reidel calls them “our four-legged students”) are typically trained in various specialties. The most common are patrol-explosive-detection dogs. These animals—usually German shepherds or Belgian Malinois, like Cairo—go out on patrol, keep watch outside bases, and conduct basic scent searches. One handler called them “the Swiss army knife of dogs,” because they can do just about anything. They also have the temperament to be aggressive when necessary; that morning, I watched as several dogs took turns sprinting forty yards across a field and leaping teeth-first at a soldier wearing a bite sleeve. “They’re trained to love biting more than anything,” another handler told me.

The other types of dogs are more docile. Combat trackers use their keen sense of smell to find people. Usually sporting breeds like retrievers, they can conduct search-and-rescue missions for missing soldiers or find enemies hiding miles away, often based on nothing more than the scent on a scrap of clothing.

Specialized search dogs, meanwhile, use their noses to find things: weapons caches, explosives, or drugs. Technology may change, but that remains a task that dogs are superior at. In 2010, for instance, after spending four years and nearly $19 billion researching technology used to locate IEDs, a Pentagon task force admitted that it hadn’t come up with anything as good as a dog.

On another morning at Lackland, I sat in on a search-dog training session led by Staff Sergeant Richard Miller. A baby-faced 32-year-old from nearby Floresville, Miller worked at his local Sonic before enlisting in the Army a year after high school. Teamed with a long-haired German shepherd named Gabe, he’d deployed twice, once to Iraq with the 3rd Brigade Combat Team and once to Afghanistan with the Special Forces. Together he and Gabe had made dozens of finds, such as the fifty pounds of explosives Gabe sniffed out in the back of a van—enough, Miller said, to make fifteen suicide vests.

Miller had to give Gabe up when he returned to Lackland to become an instructor. But on this particular morning, Gabe was back too, being retrained with another soldier. “It does tug on the heartstrings a little,” Miller admitted. “Kind of like seeing your ex-girlfriend with another guy.” Then he lowered his voice to a whisper. “A few times, he’s run past him and straight to me.” He couldn’t help but smile.

Today Gabe’s mission was a building search. Hidden somewhere inside a vast, two-story abandoned barracks was an explosive called Semtex—a single stick, about the size of a Snickers bar. It would have been nearly impossible for an average soldier to find, but it was large enough to collapse half the building.

Gabe methodically made his way down the hallway, pausing to smell each closed door. Eventually he zeroed in on what looked to be an old office, piled high with empty file cabinets and desks. As Miller and the handler looked on, Gabe slowly worked the room, smelling a chair here, a wastebasket there. Finally he came to a stop in front of a desk in the corner, where he abruptly, but nonchalantly, sat down.

“I’m gonna go ahead and call change, Staff Sergeant,” his handler said, using the military term indicating that a dog has made a find. What might have taken a team of Marines several hours Gabe had accomplished in about five minutes. If the situation had been real, he might have saved hundreds of lives. Smiling, Miller reached down and scratched him between the ears. “Good search,” he said, and tossed him his ball.

After about six months of work at Lackland, most dogs are ready to move on. Some are dispatched to Yuma Proving Ground, in Arizona, where they train alongside AK-47 fire, explosions, and thudding helicopter blades to prepare them for deployment on the battlefield. Others get specialized training at their new base, tailored to their mission. There are also so-called superdogs, like Cairo, who are assigned to special-ops units like the Rangers and SEALs. Supplied by independent contractors who receive multimillion-dollar contracts to train them, they do things like plunge from helicopters into icy waters and parachute from 25,000 feet while wearing oxygen masks. Buying and training these dogs can cost up to $50,000, and they’re protected accordingly, outfitted with everything from body armor and gas masks to GPS systems and canine goggles (a.k.a. “doggles”).

Of course, as with humans, even the most advanced gear can’t prevent casualties. In the past five years, 21 military dogs have been killed in action. Just two days before my visit to Lackland, Bart, a dog from the same SEAL team as Cairo, was killed in Afghanistan, along with 31 servicemen, when the Chinook helicopter he was riding in was shot down. Countless other dogs have been wounded in combat, by everything from an IED blast to a fall from a truck. Many of these end up at Lackland’s Holland Military Working Dog Veterinary Hospital, which offers physical therapy, a doggie dentist, and even a behavioral psychologist who specializes in C-PTSD—canine post-traumatic stress disorder. As hospital director Colonel Kelly Mann said, “We want to give these dogs the same level of care we give our human soldiers.”

Therein lies the central paradox of military dogs. Officially, they’re classified as equipment, stocked and inventoried with the same kind of serial number as screwdrivers or boots. But they’re also beloved companions for whom their handlers feel a fierce devotion—sometimes even more than for their fellow soldiers. Staff Sergeant Clayton Glover, a barrel-chested Army MP who’s done tours in Iraq and Afghanistan, got misty-eyed as he reminisced about Alf, the German shepherd who’d saved his life on more than one occasion. “It’s a special bond,” said Glover, who would sometimes bend regulations by letting Alf sleep on his cot and broke down in tears when he had to be reassigned. “I trust my dog more than I trust people.”

Or consider Private Colton Rusk, a twenty-year-old Marine dog handler from Orange Grove, near Corpus Christi. In phone calls home to his family, Rusk would often refer to Eli, his bomb-sniffing black Lab, as his best friend. They would sleep together in Rusk’s sleeping bag, eat their meals outside the mess hall because Eli wasn’t allowed in. Then one day last December, during a firefight in Afghanistan, Rusk was hit by a bullet from a Taliban sniper. Eli immediately crawled on top of him to shield his body.

Rusk didn’t survive, but thanks to some help from Governor Rick Perry, Eli was allowed to retire to Texas. In a moving ceremony at Lackland in February, he was released into the care of Rusk’s parents. Afterward, Rusk’s mother, Kathy, leaned in close and rubbed Eli’s nose. “You’re going home,” she told him.

That kind of positive outcome wasn’t always the case. Not long ago, military dogs who’d finished their service typically met an unhappy end. No process existed that allowed people to adopt the animals, so more often than not, they were destroyed. But in 2000 Congress passed the Robby Law, named for a Marine Corps dog, which allowed retired dogs to be adopted by soldiers and civilians. Patient civilians, that is: thanks in part to a spike in applications following Cairo’s front-page exploits, the current wait to adopt a military dog can be as long as a year and a half.

Still, the vast majority of dogs end up being adopted by one of their handlers. Of the dozens of soldiers I met, nearly all of them had either adopted one of their dogs or planned to. One took his dog, Ajax, home to Michigan, where he lived out the rest of his days eating bologna, watching football on TV, and keeping an eye on the door for any intruders. Glover, meanwhile, can’t wait to get his hands on Alf again. “I’m trying to get back over there with him now,” he said. “I miss him a lot.”

Gabe still has two or three years before he can retire. But Miller has already called dibs. “Me and that dog have gone through a lot together,” he said, watching him play with his ball. “I can’t count the number of times he’s saved my life. He’s stubborn and he can be a butthead. But I love him to death.”