On a frigid day in January 2009, after the chief justice of the Supreme Court bungled the oath of office, Barack Obama delivered his inaugural address to a crowd of millions and implored them to understand the gravity of the moment.

The time for “recriminations and worn-out dogmas” had ended, the president declared, in a nod to the bitter campaign that had just concluded and the crumbling U.S. economy he was inheriting. “We remain a young nation. But in the words of Scripture, the time has come to set aside childish things.”

Eight years later, the economy has improved. But those childish things very much remain, and they have clouded Obama’s swan song in office and complicated his legacy.

As Obama prepared for his final speech last week in his hometown of Chicago, his successor, Donald Trump ― a reality television host with little grasp of policy issues, save a desire to upend much of his predecessor’s agenda ― faced accusations that he’d watched Russian prostitutes urinate on his hotel bed.

It is an inharmonious and depressing bookend to the Obama years, which will be defined by historic legislative achievements, relentless partisanship and the fusion of media, entertainment and governance. And for many veterans of the administration, that failure to move beyond the immaterial distractions and endless squabbles that often consume politics is the sore spot of his legacy.

The toxicity of the environment here, we were not able to change. That doesn’t mean it can’t change in the future. It just means we fell short of where we hoped to go. Valerie Jarrett, senior adviser to President Barack Obama

“We were not as successful as we hoped we would be [in changing the culture of Washington],” said Obama’s longtime senior adviser, Valerie Jarrett, in an interview. “But I will say this: Notwithstanding that, we still made enormous progress here. We were able to get some extraordinary accomplishments done that have benefited our country. But the toxicity of the environment here, we were not able to change. That doesn’t mean it can’t change in the future. It just means we fell short of where we hoped to go.”

Though it is dwarfed by his legislative successes, Obama’s inability to change the culture of Washington is no small failure. It was the keystone to his 2008 campaign, and arguably the main ingredient in his upset primary win over Hillary Clinton and his general election triumph over John McCain.

But for some Democrats, the notion that childish things could ever be truly set aside was always a touch naive. Howard Dean, who chaired the Democratic National Committee when Obama first ran, recalled a conversation the two had after Obama had secured the Democratic nomination.

“He said, ‘I’m through the hardest part now,’” Dean recalled Obama saying. “And I said, ‘If you think that, you have another thing coming. These guys are ruthless and their only mission is that you don’t succeed.’”

To a large degree, Dean was the more prescient of the pair. The night of Obama’s inauguration, House Republicans dined with top operatives, plotting how to put the brakes on his agenda and win back power. Months later, Republican leadership announced their opposition to the Recovery Act before Obama had even finished a meeting to pitch the economic stimulus package to members of Congress. It was a sharp and early illustration of the GOP id. The fact that it took Obama years to recognize it as such, his aides now concede, was a strategic miscalculation.

But it wasn’t just the knee-jerk opposition of Republicans that confounded the Obama White House. A host of distractions and quasi-scandals during those early months and years proved maddening as well. There was the absurd cable catnip, like the infamous “terrorist fist jab” that Obama exchanged with his wife; the partisan-hyped controversies, like the conservative talk radio complaints over the president’s efforts to secure the Olympic Games in Chicago; and the rhetorical missteps that sucked the oxygen out of the room.

None were quite as memorable as what transpired on June 22, 2009. That day, Obama gave a press conference in which 12 of the first 14 questions involved his efforts to construct and pass health care reform (in between was a question on financial regulatory overhauls). The question that ended up getting the most attention, however, would be the very last, when Obama responded to a request for comment on the arrest of Harvard professor Henry Louis Gates Jr. at his Cambridge home by suggesting the officer had “acted stupidly.”

It would take a week for that micro-scandal to die down, and only after the officer, Gates and Obama met at the White House for a beer summit to talk things over.

Jim Young/Reuters The infamous beer summit.

For Obama’s staff, the challenge quickly became figuring out which crises were real and which were ephemeral. Sometimes, they arguably made matters worse, like informally blacklisting Fox News amid a torrent of conspiratorial coverage from its then-host and chalkboard aficionado Glenn Beck or elevating talk show host Rush Limbaugh as the face of the GOP in 2009 rather than dismissing him outright.

But on the whole, Obama’s aides learned to distinguish between the substance and the noise. They also figured out which battles to pick and which to avoid. Obama, for example, became notably more deliberate about addressing racial issues following the beer summit because, aides said, he recognized that his involvement often only further polarized matters.

The problem was, Obama had pledged to lower the noise and not simply skate around it. And as time went on, it became increasingly malignant. A congressman could scream “you lie” at the president during a bicameral event and raise a quick million dollars in donations. End-of-life consultations could be depicted as death panels not only on the conservative fringe, but by Republican senators the White House was trying to woo. And a reality television star could push a racist conspiracy theory about the president’s birthplace and, instead of being laughed off the air, turn it into a foundation for a White House bid.

Dan Pfeiffer, the president’s longtime aide, argued that the key element in all this was a political media culture that not only enjoyed the spectacle but profited from it. One reason that the White House ultimately decided to release Obama’s birth certificate in April 2011, for example, was because aides felt they couldn’t move past Trump’s provocations during the daily briefing.

“I remember that period very well, because there was a lot of real serious shit happening in the world, a European financial crisis, and the economy was in a bad place,” Pfeiffer told HuffPost last fall. “But Donald Trump kept going on TV and he would make these claims, and it was treated as: ‘Well, Trump says this.’ It wasn’t with great scrutiny. He was being given a bullhorn to shout racist shit without being called on it.”

While it became clearer that childish things weren’t going away, the president still attempted to forge through them. For months, he searched around for a Republican to support his health care bill, to no avail. He made an abrupt shift from Keynesian stimulus to deficit reduction to calm his conservative critics in 2010. And in the summer of 2011, he sought a grand bargain on entitlements and taxes with then-House Speaker John Boehner (R-Ohio) when there was little indication that Boehner would, or could, ever get his caucus to go along. Sure enough, the deal fell apart, replaced by a series of sharp and indiscriminate budget cuts known as sequestration.

Larry Downing/Reuters Barack Obama and John Boehner during the 2011 debt ceiling negotiations.

The president’s closest aides were fond of saying that the GOP fever would eventually break, first after Republicans won control of the House in 2010, then after they lost the election in 2012, and finally after they shut down the government in 2013. But it never did. And eventually, Obama went his own route, famously deploying his “pen and phone” strategy of executive and administrative actions.

For his close advisers and friends, it is a testament to Obama’s character that he continued believing, up until that moment, that Washington could, indeed, change its stripes. But even they recognize that his earlier reluctance to acknowledge that childish things would remain was not without sacrifice ― that the pursuit of comity sometimes came at the cost of sound messaging and policy.

“No one can look back eight years and say we couldn’t have done a better job somewhere, given the outcome,” said Anita Dunn, Obama’s former adviser. “The policies will stand the test of time, the president’s personal standing is high as he leaves office (as it should be), but somewhere along the way, too many people stopped seeing the Democratic Party as relentlessly focused on improving the economy and their lives, which opened the door for Donald Trump.”