President Obama speaks during a farewell ceremony at Joint Base Myers-Henderson Hall in Virginia on Jan. 4. (Kevin Dietsch/European Pressphoto Agency)

President Obama is spending his final few weeks in the White House trying to do what he can to preserve his legacy.

Across social media, in public addresses and exit interviews, the first black president of the United States has reminded Americans what his administration has accomplished: championing same-sex marriage, fighting sexual violence and trying to fight gun violence, creating jobs, passing the Affordable Care Act.

It has become clear to anyone who reads his tweets, or watches his speeches, or follows the White House on Instagram, that Obama, preparing to pass the baton to a man whose entire political platform revolves around erasing Obama’s, is reflecting on the last eight years.

It might be nostalgia — but it’s also strategic.

Which is why, when the Harvard Law Review published this week “The President’s Role in Advancing Criminal Justice Reform” by Barack Obama — the first time a sitting president has written for the esteemed legal publication — it seemed as though this, too, might be a part of that concerted campaign to remind the public what Obama has accomplished.

But, it turns out, the idea didn’t come from the president of the United States.

Instead, it was the far-fetched pipe dream of the president of the Harvard Law Review, Michael Zuckerman, and the publication’s articles chair, Colin Doyle.

Michael Zuckerman Michael Zuckerman, the 130th president of the Harvard Law Review.

During a conversation last August about articles they could publish in their volume of the Law Review, the two Harvard students were brainstorming “dream scenarios,” Zuckerman told The Washington Post in an email.

“With the hugely important conversation about criminal justice that’s going on — not just on law school campuses, but all over the country — we were thinking about pieces that could be particularly powerful,” Zuckerman said. “And given that the president and his administration have made criminal justice a focus, plus the president’s background as a lawyer, law professor and community organizer, this idea jumped out at us as something that could be really special.”

They shared their idea with Harvard Law School Dean and Board of Trustees President Martha Minow, an Obama appointee to the board of the Legal Services Corporation, who then facilitated a conversation with the White House.

“They’ve been wonderful partners since,” Zuckerman said.

The article (technically characterized by the publication as a “commentary”) summarizes the progress the Obama administration made in the issue of criminal justice reform and highlights the challenges that face incoming President-elect Donald Trump. In 1990, Obama was named the Harvard Law Review’s first black president, a leadership role that thrust him into the national spotlight decades before he would make history as the United States’ first black president.

In his article, Obama writes that mass incarceration is a financial drain and that without creating and improving successful reintegration programs, the country’s jails and prisons will remain a revolving door.

“In addition, we cannot deny the legacy of racism that continues to drive inequality in how the justice system is experienced by so many Americans,” he writes.

Obama also touches on police reform, technology aides, forensic science, gun safety, the nation’s opioid epidemic and the need for bipartisan criminal justice reform legislation.

And despite the author’s inherent prestige, Zuckerman said, the article went through the same rigorous editing process that every other Law Review submission endures. Though he would not reveal whether they communicated directly with Obama, citing their author confidentiality policy, Zuckerman did say they compressed the editing schedule given the constraints of the president’s schedule. It demanded quick turnarounds from the president and the publication’s team of editors, who worked through the night and sometimes as late as 6 a.m., only to begin again hours later.

“I will say that we were very impressed by the level of engagement that the president gave our comments and our editing process in general, despite clearly having many more important things to worry about,” Zuckerman told The Post. “It wasn’t lost on us how incredibly lucky we were to have gotten to work on something like this. I mean, we’re third-year law students, editing this piece on the eve of final exams. And so in the back of our minds we know we have to get back to studying for our Evidence or First Amendment exam soon, but here we are editing the first piece of legal scholarship by a sitting president of the United States.”

But what made this experience — and topic — so particularly poignant for Zuckerman was that it was also deeply personal.

Sixteen years ago, during the summer between seventh and eighth grade, Zuckerman was arrested and pleaded guilty to criminal trespassing in New Jersey. He was 13.

Zuckerman and a friend knew that the family of a third friend was on vacation, he told The Post, so they climbed through an open window and “did all sorts of stupid things while inside, including drinking their alcohol.”

“I don’t want to give the impression that I was Al Capone here,” Zuckerman said. “It was a complicated time for me; my dad had passed away the year before, and I was going through a pretty rebellious phase.”

But, he said, the second chance he was given through the criminal justice system fundamentally shaped him and his future.

He retained a lawyer, who was also a family friend, and the court put him in a juvenile diversion program, which essentially meant he had to do community service and stay out of trouble. With homeless children who lived in motels on the highway, Zuckerman would do art projects, he told The Post, an experience that made him aware of his own privilege but also taught him to channel his energy into “more productive things than trying to, say, steal alcohol from people’s houses.”

Beyond that, it made him realize the profound impact that diversion programs — and second chances — can have on impressionable youth.

“What’s always seemed crystal clear to me is that, as well as that all worked out for me, there are lots of kids with just as much to offer who may not have been white, or middle-class, or had a family friend who was a lawyer, whose lives went a different direction when they started making bad decisions around that age,” Zuckerman said. “And so I’ve always felt a debt that I don’t think I can ever really repay. I got a second chance, and got to channel my energy into all these productive things, and plenty of other kids — and especially plenty of other kids who don’t look like me — don’t get that second chance.

“So being able to publish a piece in which the president of the United States talks about the importance of second chances is very meaningful to me personally.”

More from Morning Mix

A Florida mom put her 10-year-old on a timeout. Then came the gunshot, police say.

Hate crime charges filed after ‘reprehensible’ video shows attack on mentally ill man in Chicago

‘Star Wars’ actor Diego Luna did not hide his Mexican accent — and Latinos heard it loud