It’s never easy being a president in his eighth year, when the spotlight is fading, would-be successors are bashing him, and the opposition party doesn’t even want to let him pick another Supreme Court justice.

So Barack Obama seized the opportunity to strike back.

In taking on Donald Trump at that California presser, Obama seemed to be giving voice to lots of pent-up resentments. It is highly unusual for a president to whack the other party’s front-runner so early in the process, but that didn’t deter Obama—perhaps because he senses that after South Carolina, Trump may be very difficult to stop.

To be sure, Trump has attacked the president so relentlessly on so many issues, from health care to terrorism, that it’s easy to understand why Obama wanted to get a few licks in. But there’s a back story that goes beyond sparring on the trail.

Five years ago, Trump garnered enormous attention for appearing the embrace the birther movement, questioning whether Obama was actually born in Hawaii. Then, as now, much of the media and political establishment came down on Trump for pushing a conspiracy theory, although the billionaire kept saying he was just raising the question. He got under Obama’s skin, and finally prodded the president into releasing his long-form birth certificate.

I was at the White House Correspondents Dinner when Obama took delight in mocking Trump, who was glowering in the audience as a guest of the Washington Post.

The latest headlines on the 2016 elections from the biggest name in politics. See Latest Coverage →

“No one is happier—no one is prouder—to put this birth certificate matter to rest than The Donald,” Obama said in 2011. “And that’s because he can finally get back to focusing on the issues that matter: Like, did we fake the moon landing? What really happened in Roswell? And where are Biggie and Tupac?”

So it’s personal.

Thus it was that Obama told reporters on Tuesday: “I continue to believe Mr. Trump will not be President.  And the reason is because I have a lot of faith in the American people, and I think they recognize that being President is a serious job.  It’s not hosting a talk show or a reality show.  It’s not promotion.  It’s not marketing. It’s hard.” 

Obama did try to pivot to the other Republicans, saying Trump’s rivals agree with him on many issues but just don’t put things as colorfully. There was also a not-so-veiled shot at Marco Rubio on immigration. But Trump was the only one he mentioned by name.

Surely Obama recognizes that his opposition only helps Trump with Republicans by elevating him. My guess is that he weighed that factor against the downside of remaining silent.

It’s highly unusual for a president to attack the other party’s front-runner this early in the cycle. In August 1988, referring to rumors that Michael Dukakis had been treated for depression, President Ronald Reagan jokingly said “I’m not going to pick on an invalid.” But Dukakis had already won the Democratic nomination.

In fact, Trump is now at war with the last two presidents—Obama and George W. Bush—which burnishes his brand of taking on the establishment in both parties. 

Bush is a riskier target for a Republican, but so far it doesn’t seem to have hurt Trump.

Meanwhile, Obama chose to weigh in on the Democratic contest as well:

“I know Hillary better than I know Bernie because she served in my administration and she was an outstanding secretary of State. And I suspect that on certain issues she agrees with me more than Bernie does.  On the other hand, there may be a couple issues where Bernie agrees with me more, I don't know.” 

That was virtually an endorsement, or as close as a president proclaiming to stay neutral can come. And Hillary Clinton, after some earlier distancing, is hugging Obama pretty closely as she finds herself in an unexpectedly tight contest with Bernie Sanders after getting clobbered in New Hampshire. She not only invokes their working relationship but has chided Sanders for his criticism of Obama and for encouraging a primary challenge in 2012.

Clearly, Obama wants his former rival to be the one to potentially take on his former tormentor, Donald Trump.

Howard Kurtz is a Fox News analyst and the host of "MediaBuzz" (Sundays 11 a.m. and 5 p.m. ET). He is the author of five books and is based in Washington. Follow him at @HowardKurtz. Click here for more information on Howard Kurtz.