Secretary of State Rex Tillerson said Friday that President Trump’s sudden decision to go to North Korea to meet with dictator Kim Jong Un was the commander-in-chief’s alone.

“The decision to engage between President Trump and Kim Jong Un, that’s a decision the president took himself,” Tillerson said from the presidential palace in Djibouti, a stop on his tour of African nations.

Tillerson — who had said the day before that now was not the time to negotiate with the North — then tried to draw a distinction between “talks” and “negotiations.”

“With respect to talks with North Korea versus negotiations — and I think this seems to be something that people continue to struggle with the difference,” he said in remarks released by the State Department.

“My comments have been that we’re — the conditions are not right for negotiations, but we’ve been saying for some time we are open to talks. President Trump has said for some time that he was open to talks and he would willingly meet with Kim Jong Un when conditions were right and the time was right. And I think in the president’s judgment, that time has arrived now,” he explained.

“So there’s no — in my comments yesterday, I was indicating comments about negotiations, but we’ve been open for talks for some time.”

Trump made the bombshell call Thursday night after South Korean officials told him that Kim was amenable to a visit.

It would be the first time a US president has visited the dictatorship and met with the rogue regime.

The secretary of state said he spoke to Trump earlier Friday — and insisted that the president’s announcement “was not a surprise in any way” despite his own comments a day earlier that the US was “a long ways” from direct talks.

“I spoke to him very early this morning about that decision and we had a good conversation. This is something that he’s had on his mind for quite some time, so it was not a surprise in any way. He’s expressed it openly before about his willingness to meet with Kim Jong Un,” he said.

Several Pentagon officials also said shortly before the announcement that they had no knowledge of what the South Koreans planned to announce when they told the president that Kim would welcome a visit.

Meanwhile, foreign policy experts warned that Kim could use the visit to build his own credibility as a legitimate world leader — and was unlikely to sacrifice his nuclear arsenal.

“Talks can be good, but a summit should be a carrot for the end of a satisfactory process, not the beginning,” Richard Fontaine, president of the Center for a New American Security, told the Washington Post.

He warned that there was a “high chance Kim will pocket the optics, show his people and the world he is received as a legitimate head of state, and in the end keep his programs intact.”

“The risk is that Trump has little knowledge of the history of negotiations with North Korea,” Gary Schmitt of the American Enterprise Institute told the paper.

“There is some chance he will think that he has a unique opportunity to make progress on North Korea’s nuclear program, when in fact he’s going down the same road that the Clinton and Bush administrations have. North Korea is not giving up its nuclear weapons. Period.”

Talks could also be complicated by the resignation last month of special envoy Joseph Yun, America’s most experienced hand on North Korea. He has not been replaced.

The talks could come as early as May, though no date has been set.