President Obama made good sense Thursday in urging Donald Trump “to stand up to Russia” when necessary.

“My hope is the president-elect” will “cooperate with Russia where our values and interests align” but “stand up” to it when it acts against “our values and international norms,” said Obama, who was in Europe this week to bid foreign leaders farewell. That would be more than Obama himself has done.

Sure, Obama has been willing to “cooperate”; recall that Russian “reset”? But when Moscow broke the rules, the White House played doormat. From Russia’s aggression in Ukraine to its support for Syrian butcher Bashar al-Assad, Obama rarely responded with anything beyond scolding rhetoric.

Yet the outgoing president did reassure foreign leaders about the US commitment to NATO — and that was important. During the campaign, Trump called NATO an “obsolete” alliance and hinted the United States might drop out if Europe doesn’t pull its weight.

Now, it’s true that its funding has been a sore point for decades; Obama himself has denounced NATO’s “free-riders.”

But European leaders are on edge. On Monday they agreed on a new defense plan (initiated before the election) that makes it easier to deploy forces without Washington’s OK.

Let’s face it: NATO is too vital to let collapse. It has kept peace in Europe, maintained Western unity and served as the cornerstone of global security for seven decades.

So good for Obama for assuring Europe there won’t be any “weakening of resolve” by America. Trump, he said, “expressed a great interest in maintaining our core strategic relationships” and told him he was committed to the trans-Atlantic alliance.

(Trump didn’t confirm Obama’s account of their talk, but he didn’t deny it, either.)

Since the election, Obama has been saying some wise things. If Trump heeds them, his record can well outshine Obama’s own.