Law enforcement officers photograph a window at the White House in this Nov. 16, 2011, file photo. A bullet shot at the house hit an exterior window of the White House and was stopped by ballistic glass, the Secret Service said at the time. (Haraz N. Ghanbari/AP)

The gunman parked his black Honda directly south of the White House, in the dark of a November night, in a closed lane of Constitution Avenue. He pointed his semiautomatic rifle out of the passenger window, aimed directly at the home of the president of the United States, and pulled the trigger.

A bullet smashed a window on the second floor, just steps from the first family’s formal living room. Another lodged in a window frame, and more pinged off the roof, sending bits of wood and concrete to the ground. At least seven bullets struck the upstairs residence of the White House, flying some 700 yards across the South Lawn.

President Obama and his wife were out of town on that evening of Nov. 11, 2011, but their younger daughter, Sasha, and Michelle Obama’s mother, Marian Robinson, were inside, while older daughter Malia was expected back any moment from an outing with friends.

Secret Service officers initially rushed to respond. One, stationed directly under the second-floor terrace where the bullets struck, drew her .357 handgun and prepared to crack open an emergency gun box. Snipers on the roof, standing just 20 feet from where one bullet struck, scanned the South Lawn through their rifle scopes for signs of an attack. With little camera surveillance on the White House perimeter, it was up to the Secret Service officers on duty to figure out what was going on.

Then came an order that surprised some of the officers. “No shots have been fired. . . . Stand down,” a supervisor called over his radio. He said the noise was the backfire from a nearby construction vehicle.

The night bullets hit the White House — and the Secret Service didn’t know

That command was the first of a string of security lapses, never previously reported, as the Secret Service failed to identify and properly investigate a serious attack on the White House. While the shooting and eventual arrest of the gunman, Oscar R. Ortega-Hernandez, received attention at the time, neither the bungled internal response nor the potential danger to the Obama daughters has been publicly known. This is the first full account of the Secret Service’s confusion and the missed clues in the incident — and the anger the president and first lady expressed as a result.

By the end of that Friday night, the agency had confirmed a shooting had occurred but wrongly insisted the gunfire was never aimed at the White House. Instead, Secret Service supervisors theorized, gang members in separate cars got in a gunfight near the White House’s front lawn — an unlikely scenario in a relatively quiet, touristy part of the nation’s capital.

It took the Secret Service four days to realize that shots had hit the White House residence, a discovery that came about only because a housekeeper noticed broken glass and a chunk of cement on the floor.

This report is based on interviews with agents, investigators and other government officials with knowledge about the shooting. The Washington Post also reviewed hundreds of pages of documents, including transcripts of interviews with officers on duty that night, and listened to audio recordings of in-the-moment law enforcement radio transmissions.

Secret Service spokesman Ed Donovan declined to comment. A spokesman for the White House also declined to comment.

The episode exposed problems at multiple levels of the Secret Service, and it demonstrates that an organization long seen by Americans as an elite force of selfless and highly skilled patriots — willing to take a bullet for the good of the country — is not always up to its job.

Just this month, a man carrying a knife was able to jump the White House fence and sprint into the front door. The agency was also embarrassed by a 2012 prostitution scandal in Cartagena, Colombia, that revealed what some called a wheels-up, rings-off culture in which some agents treated presidential trips as an opportunity to party.

The actions of the Secret Service in the minutes, hours and days that followed the 2011 shooting were particularly problematic. Officers who were on the scene who thought gunfire had probably hit the house that night were largely ignored, and some were afraid to dispute their bosses’ conclusions. Nobody conducted more than a cursory inspection of the White House for evidence or damage. Key witnesses were not interviewed until after bullets were found.

Moreover, the suspect was able to park his car on a public street, take several shots and then speed off without being detected. It was sheer luck that the shooter was identified, the result of Ortega, a troubled and jobless 21-year-old, wrecking his car seven blocks away and leaving his gun inside.

The response infuriated the president and the first lady, according to people with direct knowledge of their reaction. Michelle Obama has spoken publicly about fearing for her family’s safety since her husband became the nation’s first black president.

Her concerns are well founded — President Obama has faced three times as many threats as his predecessors, according to people briefed on the Secret Service’s threat assessment.

“It was obviously very frightening that someone who didn’t really plan it that well was able to shoot and hit the White House and people here did not know it until several days later,” said William Daley, who was White House chief of staff at the time.

Daley said he recalls the late discovery of the bullets shaking up the Obamas and their staffs. The Secret Service could not have prevented the shooting, Daley said, but it should have determined more quickly what happened.

“The handling of this was not good,” he said.

Confusion after shots

By the time Ortega shot at the White House, President Obama and the first lady were in San Diego on their way to Hawaii for the Veterans Day weekend.

With the first couple gone, the Secret Service staff at the White House slipped into what some termed a “casual Friday” mode.

By 8:30 p.m., most of the Secret Service agents and officers on duty were coming to the tail end of a quiet shift.

An undercover agent in charge of monitoring the White House perimeter for suspicious activity, McClellan Plihcik, had left with a more junior officer to fill up his service car at a gas station about a mile away.

On the White House’s southern border, a few construction workers were milling about. D.C. Water trucks, arriving on Constitution Avenue to clean sewer lines, had just parked in the lane closed off by red cones on the White House side of the street.

It was near that spot that Ortega pulled over his black 1998 Honda Accord.

Ortega had left his Idaho home about three weeks earlier, during a time his friends said he had been acting increasingly paranoid. He kept launching into tirades about the U.S. government trying to control its citizens, saying President Obama “had to be stopped.”

He had arrived in Washington on Nov. 9. He had 180 rounds of ammunition and a Romanian-made Cugir semiautomatic rifle, similar to an AK-47, that he had purchased at an Idaho gun shop.

Now, in striking distance of the president’s home, Ortega raised his weapon.

A woman in a taxi stopped at a nearby stoplight immediately took to Twitter to describe the actions of “this crazy guy.”

“Driver in front of my cab, STOPPED and fired 5 gun shots at the White House,” she wrote, adding, “It took the police a while to respond.”

Another witness — a visiting neuroscientist who was riding by in an airport shuttle van — later told investigators he had seen a man shooting out of a car toward the White House.

On the rooftop of the White House, Officers Todd Amman and Jeff Lourinia heard six to eight shots in quick succession, likely semiautomatic fire, they thought. They scurried out of their shedlike booth, readied their rifles and scanned the southern fence line.

Under the Truman Balcony, the second-floor terrace off the residence that overlooks the Washington Monument, Secret Service Officer Carrie Johnson heard shots and what she thought was debris falling overhead. She drew her handgun and took cover, then heard a radio call reporting “possible shots fired” near the south grounds.

Johnson called the Secret ­Service’s joint operations center, at the agency’s headquarters on H Street Northwest, to report she was breaking into the gun box near her post, pulling out a shotgun. She replaced the buckshot inside with a more powerful slug in case she needed to engage an attacker.

The shots were fired about 15 yards away from Officers William Johnson and Milton Olivo, who were sitting in a Chevrolet Suburban on the Ellipse near Constitution Avenue.

They could smell acrid gunpowder as they jumped out of their vehicle, hearts pounding. Johnson took cover behind some flowerpots. Olivo grabbed a shotgun from the Suburban’s back seat and crouched by the vehicle.

William Johnson noticed a curious clue as he crouched in the crisp autumn air — leaves had been blown away in a line-like pattern, perhaps by air from a firearm muzzle. It created a path of exposed grass pointing from Constitution Avenue north toward the White House.

Then another call came over the radio from a supervising sergeant — the one ordering agents to stand down.

The call led to some confusion and surprise, especially for officers who felt sure they had heard shots. Nevertheless, many complied, holstering their guns and turning back to their posts.

But William Johnson knew shots were fired and got on his radio to say so. “Flagship,” he said, using the code name for the command center, “shots fired.”

Ortega, meanwhile, was driving away “like a maniac,” the woman in the cab wrote on Twitter.

He was speeding down Constitution Avenue toward the Potomac River at about 60 mph, according to witnesses.

Ortega narrowly missed striking a couple crossing the street before he swerved and crashed his car.

Three women walking nearby heard the crash, and one called 911 on a cellphone. As they walked closer to the scene, the women saw the Honda spun around, headlights glaring at oncoming traffic, half on the on-ramp to the Roosevelt Bridge carrying Interstate 66 into Virginia. The driver’s-side door was flung open. The radio was blaring. The driver was gone.

At the same time, Park Police and Secret Service patrol cars were beginning to swarm the bridge area. Nestled in the driver console was a semiautomatic assault rifle, with nine shell casings on the floor and seat.

Plihcik, the special agent who had been gassing up his patrol car, was among those arriving on the scene. A homeless man told him he had seen a young white male running from the vehicle after the crash and heading toward the Georgetown area.

Amid conflicting radio chatter, including a Secret Service dispatcher calling into 911 with contradictory descriptions of vehicles and suspects, police began looking for the wrong people: two black men supposedly fleeing down Rock Creek Parkway.

The man who had shot at the White House had disappeared on foot into the Washington night, with the Secret Service still trying to piece together what he had done.

Fear for girls’ safety

Back in the White House, key people in charge of the safety of the president’s family were not initially aware that a shooting had occurred.

Because officers guarding the White House grounds communicate on a different radio frequency from the one used by agents who protect the first family, the agent assigned to Sasha learned of the shooting a few minutes later from an officer posted nearby.

The White House usher on duty, whose job is tending to the first family’s needs, got delayed word as well. She immediately began to worry about Malia, who was supposed to be arriving any minute. The usher told the staff to keep Sasha and her grandmother inside. Malia arrived with her detail at 9:40 p.m., and all doors were locked for the night.

The Secret Service’s watch commander on duty, Capt. David Simmons, had been listening to the confusing radio chatter since the first reports of possible shots.

When word came of the wrecked Honda, Simmons left the command center and drove to the scene at the foot of the Roosevelt Bridge.

It was up to Simmons to decide whether the events of that night appeared to be an attack on the White House. After consulting with investigators and calling his bosses at home to confer, he turned the case over to the U.S. Park Police, the agency with jurisdiction over the grounds near the White House.

In effect, the Secret Service had concluded there was no evidence linking the shooting to the White House.

U.S. Park Police spokesman David Schlosser told reporters at the time that the connection was a big coincidence. “The thing that makes it of interest is simply the location, you know, a bit like real estate,” he said.

At the time of the shooting, President Obama had been sitting courtside on the USS Carl Vinson warship in the California’s Coronado Bay, watching the University of North Carolina and Michigan State University basketball teams play on the flight deck. He was getting ready to be interviewed by ESPN at 9 p.m.

Forty-five minutes later, the president and Michelle Obama climbed aboard Air Force One, bound for a trade summit in Hono­lulu, unaware that a man had taken several shots at their living quarters.

Housekeeper’s discovery

The next day, things seemed to have settled down at the White House.

Officer Carrie Johnson, who had heard debris fall from the Truman Balcony the night before, listened during the roll call before her shift Saturday afternoon as supervisors explained that the gunshots were from people in two cars shooting at each other.

Johnson had told several senior officers Friday night that she thought the house had been hit. But on Saturday she did not challenge her superiors, “for fear of being criticized,” she later told investigators.

Though the Park Police was now in charge of the investigation, Secret Service agents continued to assist, using social media and other sources to locate witnesses, such as the tweeting taxi passenger, and people who knew Ortega.

Investigators did not issue a national lookout to notify law enforcement that Ortega was wanted. If they had, Ortega could have been arrested that Saturday in Arlington County, Va., where police responded to a call about a man behaving oddly in a local park. They questioned Ortega but had no idea he was a suspect in a shooting, and they let him go.

The Park Police did not obtain a warrant for Ortega on weapons charges until that Sunday. A Park Police spokeswoman, reached this Friday, declined to comment, saying the agency needed more time to review the episode.

Meanwhile, Secret Service agents, who had been learning from Ortega’s friends and family that he was obsessed with President Obama, began canvassing the D.C. area to locate him.

The situation at the White House remained quiet until Tuesday morning. President Obama was continuing from Hawaii to Australia. But the first lady had returned to Washington on an overnight flight. She had gone upstairs to take a nap shortly after arriving home early that morning.

Flying back on her plane was Secret Service Director Mark Sullivan. At that time, his agents were learning that Ortega, still at large, appeared to be obsessed with the president. The episode had not yet risen to the level of a confirmed threat that the Secret Service would share with the first couple, according to people familiar with agency practice.

Reginald Dickson, an assistant White House usher, had come to work early to prepare the house for the first lady.

Around noon, a housekeeper asked Dickson to come to the Truman Balcony, where she showed him the broken window and a chunk of white concrete on the floor.

Dickson saw the bullet hole and cracks in the antique glass of a center window, with the intact bulletproof glass on the inside. Dickson spotted a dent in another window sill that turned out to be a bullet lodged in the wood.

Dickson called the Secret Service agent in charge of the complex.

Suddenly, Ortega was no longer just a man who had abandoned a car with a rifle inside. He was now a suspect in an assassination attempt on the president of the United States — and he was about to become the target of a national manhunt.

Daley, the White House chief of staff, was alerted by aides about the discovery on the second floor of the residence.

The first lady was still napping, and Daley and his aides knew it was their job to tell her. They debated whether they should wake her up and give her the news.

They decided, according to people familiar with the discussions, to let her sleep. Instead, they concluded, they would brief the president and let him tell his wife.

But someone else told her first.

First lady furious

Dickson, the usher, went upstairs to the third floor to see how Michelle Obama was doing.

He assumed she knew about the bullets and began describing the discovery.

But she was aghast — and then quickly furious. She wondered why Sullivan had not mentioned anything about it during their long flight back together from Hawaii, according to people familiar with the first lady’s reaction.

That afternoon, Secret Service investigators for the first time began interviewing officers and agents who had been on the grounds the previous Friday night.

Authorities put out an all-points bulletin for Ortega and circulated his picture. Local police officers up and down the Eastern Seaboard were tasked with checking train and bus stations.

A team of FBI agents met early that evening to plan for taking over the investigation and securing the crime scene at the White House.

At 7:45 a.m. the next day, FBI agents arrived at the White House complex.

They interviewed some of the Secret Service officers who were on duty that Friday night and scoured the Truman Balcony and nearby grounds for casings, bullet fragments and other evidence.

The agents that day found $97,000 worth of damage.

At that same time, state troopers were headed to a Hampton Inn in Indiana, Pa. A desk clerk, on alert after Secret Service agents found out Ortega had stayed there and circulated his picture, called police after recognizing the man with a distinctive tattoo on his neck. They arrested Ortega and kept him chained at his feet and hands in a holding cell until FBI agents could arrive to question him.

Back at the White House, Michelle Obama was worried about how the scene of agents on the family balcony might upset her daughters. She relayed a special request that the FBI team finish their work on the balcony by 2:35 p.m., before Sasha and Malia came home from school.

The first lady was still upset when her husband arrived home five days later from Australia. The president was fuming, too, former aides said. Not only had their aides failed to immediately alert the first lady, but the Secret Service had stumbled in its response.

“When the president came back . . . then the s--- really hit the fan,” said one former aide.

Tensions were high when Sullivan was called to the White House for a meeting about the incident. Michelle Obama addressed him in such a sharp and raised voice that she could be heard through a closed door, according to people familiar with the exchange. Among her many questions: How did they miss bullets from an assault rifle lodged in the walls of her home?

Sullivan disputed this account of the meeting but declined to characterize the encounter, saying he does not discuss conversations with the first lady.

Problems exposed

Ortega was eventually charged with attempted assassination. His attorneys insisted he had no idea what he was doing. He pleaded guilty to slightly lesser charges and was sentenced to 25 years in prison.

The next year, the Colombia prostitution scandal rocked the agency’s reputation. Sullivan retired from the agency in 2013 to start a private security firm. President Obama named the first woman to head the service, Julia Pierson, with hopes she could help end Cartagena-like embarrassments.

Yet, on Capitol Hill and among many former Secret Service officials, the 2011 shooting was a sign of far deeper troubles. For them, no duty is more sacred than protecting the life of the president and his family, and on this night a man nearly got away with shooting into his house. In this case, they fear, a more powerful weapon might have pierced the residence, or the Obama daughters could have been on the balcony.

“This is symptomatic of an organization that is not moving in the right direction,” Rep. Jason Chaffetz (Utah), a leading Republican on the House Oversight and Government Reform Committee, said in an interview. The committee, which oversees the Secret Service, has invited the director to testify at a Tuesday hearing on security issues.

A subsequent internal security review found that the incident illustrated serious gaps.

The Secret Service, for instance, could not use any of the dozens of ShotSpotter sensors installed across the city to help police pinpoint and trace gunshots. The closest sensor was more than a mile away, too far to track Ortega’s shots.

Sullivan acknowledged in closed congressional briefings that the agency lacked basic camera surveillance that could have helped agents see the attack and swarm the gunman immediately.

Some of the technology issues have since been addressed, according to officials. The agency added a series of surveillance cameras in 2012, giving authorities a full view of the perimeter.

Alice Crites and Julie Tate contributed to this report.