On Sept. 11, 2001, Secret Service agents raced Vice President Richard B. Cheney to a secure underground bunker below the White House — only to realize that they couldn’t immediately usher him inside to safety because they didn’t have the tightly guarded S-keys required to open the shelter.

Almost a decade later, Secret Service agents allowed a disoriented homeless man to wander through an unguarded staircase and get within steps of first lady Michelle Obama’s suite at the Beverly Hilton hotel.

Years after that, President Donald Trump — who had a penchant for surrounding himself with people who looked like they were out of central casting — was consumed with getting overweight Secret Service agents removed from their posts, saying he wanted “these fat guys off my detail” and asking: “How are they going to protect me and my family if they can’t run down the street?”

These are among the revelations in “Zero Fail: The Rise and Fall of the Secret Service,” a new book by Washington Post reporter Carol D. Leonnig that chronicles the successes, missteps and evolution of the agency tasked with protecting the American president.

Leonnig — whose three Pulitzer Prizes include one in 2015 for exposing security failures and misconduct in the Secret Service — describes an agency that has long been strapped for resources and often mismanaged while lacking robust oversight from the lawmakers, leaders and, sometimes, even the presidents who should have been protecting it. The Post obtained a copy of the book ahead of its Tuesday publication.

Although Leonnig does depict some heroics by the Secret Service, her 487-page tome largely focuses on the challenges and stumbles — bureaucratic and otherwise — of the agency she describes as “spread dangerously thin” through 11 presidents, starting with the assassination of John F. Kennedy and placing a particular emphasis on the George W. Bush, Obama and Trump eras.

“I still firmly believe they have to modernize — and not just when it comes to resources,” one Trump administration official who oversaw the agency tells Leonnig, in a candid analysis that faults not just the Secret Service but several of the presidents it was tasked to protect. “Technology is the first thing. If anyone has seen the television show ‘24,’ they would die if they saw what the Secret Service has. It’s a joke.”

Having first reported on the Secret Service for The Post in the wake of the agency’s 2012 prostitution scandal in Cartagena, Colombia — when, as Leonnig writes, “a dozen agents and officers stood accused of turning a presidential trip to a South American resort town into a kind of Vegas bachelor party, complete with heavy drinking and prostitutes” — she devotes a chapter of the book to unspooling vivid details about the incident.

“Take us where the girls are,” one agent directs his taxi driver, and so the night begins, with Leonnig chronicling the escapades down to the minutia (“a mojito and at least eight beers”) and through a dispute about payment (“He vaguely remembered her saying something as they left the club about wanting money for sex. But $800?”) that helped propel the incident into an international scandal and led one member of the Counter Assault Team to later declare, “I woke up to a nightmare.”

Leonnig describes a “wheels up, rings off” culture — wedding rings and vows are removed when the plane lifts up to its next destination — where sex often proves a complicating factor, for the agents and protectees alike.

She writes of how Kennedy repeatedly slipped his detail for dalliances, with his agents standing “witness to a steady parade of secretaries, starlets, and even prostitutes escorted to the president’s bedroom.” (“What happens if one bites him?” asks a nervous new agent, still unaccustomed to the “What happens in the White House stays in the White House” ethos). And she writes of how agents protecting then-presidential candidate Bill Clinton again willfully ignored the romantic trysts he orchestrated while ostensibly working out at the YMCA in Little Rock — although a Clinton spokesman refuted the claim to Leonnig.

Rumors of romantic relationships between agents and Trump family members also prevail. Secret Service agents, for instance, report that Vanessa Trump, the ex-wife of the president’s oldest son, “had gotten very close to one of the agents who had been assigned to her family,” Leonnig writes.

A representative for the Trump family did not respond to requests for comment on behalf of Vanessa Trump.

And after Tiffany Trump, the president’s daughter with his ex-wife Marla Maples, and her boyfriend broke up, Leonnig writes, “she began spending an unusual amount of time alone with a Secret Service agent on her detail,” prompting agency leadership to worry about “how close Tiffany appeared to be getting to the tall, dark, and handsome agent.”

A spokeswoman for Tiffany Trump denied the report, saying, “This is nothing more than gossip and is simply not true. Tiffany’s experience with the Secret Service was entirely professional.”

There were other tensions during the Trump era, as well. Leonnig recounts how Trump wanted the Secret Service to redesign the black fence surrounding the White House because he thought it looked “too much like a prison,” and proposed a multimillion-dollar renovation “to dig up and replace all the lowered gates, because he hated the bump he felt when his limo drove over them.” His advisers ultimately kept delaying the expensive project, hoping he would simply forget, Leonnig writes.

Jason Miller, a senior adviser to Trump, said Trump’s “concern was for the Beast, a very expensive security vehicle that was being subjected to unnecessary wear and tear.”

Agents, too, came under scrutiny during the Trump years. Donald Trump III, Trump’s 8-year-old grandson, once awoke in the back of his detail’s sport utility vehicle to find that an agent who was supposed to be protecting him had instead crawled into the back of the truck to snap a selfie with the unsuspecting young charge, Leonnig writes.

And following the deadly Jan. 6 insurrection at the U.S. Capitol, spurred on by Trump, some agents took to social media to express solidarity with the rioters. “One Secret Service officer called the armed protesters ‘patriots’ seeking to undo an illegitimate election,” Leonnig writes, “and falsely claimed to her friends that disguised antifa members had started the violence.”

President Biden’s transition advisers were so wary of Trump’s damaging hold on the agency that they urged the Secret Service to swap out all members of Trump’s protective detail before Biden was officially sworn in, Leonnig reports.

Biden spokesman Andrew Bates called the anecdote “flatly untrue,” saying the Secret Service “is solely responsible for all staffing decisions, not protectees. No request was ever made.”

Cathy Milhoan, director of communications for the Secret Service, praised the agency in a statement. “The U.S. Secret Service is aware of an upcoming book which re-hashes past challenges the agency overcame and evolved from,” she wrote. “Now and throughout its 156 year history, the agency’s skilled workforce is dedicated to the successful execution of its critical protective and investigative missions.”

Leonnig explains that her book is drawn from hundreds of hours of interviews with more than 180 people, including current and former Secret Service agents, officers and directors, Cabinet members, and congressional lawmakers and aides across the eight previous presidential administrations.

“I spoke with Secret Service Staff who worked a heartbeat from the president and in far-flung field offices, and with the equally dedicated members of their families,” she writes in her author’s note.

Her book does depict some of the bravery and valor of the agency. She writes of how the Secret Service refashioned itself after Kennedy’s assassination and the attempted assassination of President Ronald Reagan, using the hard lessons to refashion itself for new challenges in the modern era.

And she writes of the agents who, during the Sept. 11 attacks, raced to the Emergency Operations Center on top of the Eisenhower Executive Office Building inside the White House complex, knowing full well that if one of the hijacked planes hit the White House, they would be collateral damage.

“When the incoming plane was three minutes out,” Leonnig writes, a deputy in charge of presidential protection turned to her crew and told them “that anyone who wanted to leave could. There would be no judgment, she said. The White House now had a bull’s eye on it.”

But, Leonnig continues, “everyone stayed.”

Leonnig ends her book by thanking “the Secret Service agents, past and present, who have given so much to our country” to ensure that “our democracy remains safe.” But she depicts a neglected agency of “patriots,” understaffed, underfunded and repeatedly let down by their leaders and elected officials.

This, she concludes, “should haunt us all.”