“I look very much forward to working with him!” President Trump said in a tweet congratulating the winner of the French presidential election. (J. David Ake/Associated Press)

BEDMINSTER, N.J. — President Trump on Sunday took to Twitter to congratulate Emmanuel Macron for winning France’s presidential election, giving a nod to a centrist who didn’t seem to have been his preferred candidate.

“Congratulations to Emmanuel Macron on his big win today as the next President of France,” Trump said in his tweet. “I look very much forward to working with him!”

A brief, more formal statement followed a few minutes later in which White House press secretary Sean Spicer added, “We look forward to working with the new President and continuing our close cooperation with the French government.”

There was no word from the White House on whether Trump had made a congratulatory phone call.

The U.S. president had stopped short of making an endorsement in the race, saying it was up to the French people to pick their next leader.

But before the first round of voting in France last month, Trump described anti-E.U. candidate Marine Le Pen as “the strongest on borders” and said “she's the strongest on what's been going on in France,” referring to terrorist attacks, among other trends.

Trump also weighed in on Twitter shortly before the first round, saying a terrorist attack in which a police officer was killed in Paris would “have a big effect” on the French election.

“The people of France will not take much more of this,” Trump wrote in a tweet in which he did not refer to Le Pen by name but was widely interpreted to be referring to her.

Trump had been less vocal about the election in the lead-up to Sunday's runoff.

On the campaign trail this spring, Le Pen’s rhetoric had often echoed Trump’s, with vows to put “France first” and to defend “the forgotten France.” She also condemned globalist cosmopolitans — Macron chief among them — who she said did not have the nation’s interests at heart.

But she had distanced herself from Trump since his inauguration, often declining to mention him by name, and analysts said her association with the unpopular U.S. president may have hurt her among French voters.

Trump was preparing to return to Washington on Sunday night after three full days at his secluded golf club here in New Jersey. He made no public appearances on Friday or Saturday and had no scheduled events before his departure on Sunday.

Griff Witte contributed to this report.