President Donald Trump on Friday abruptly reversed U.S. policy toward Libya, issuing a statement publicly endorsing an aspiring strongman in his battle to depose the U.N.-backed government.

The would-be strongman, Khalifa Hifter, launched a surprise attack on the Libyan capital, Tripoli, more than two weeks ago. Relief agencies said Thursday that more than 200 people had been killed, and in recent days, Hifter’s forces have started shelling civilian neighborhoods.

A few days after the attack, Secretary of State Mike Pompeo said that “the administration at the highest levels” had made clear that “we oppose the military offensive” and “urge the immediate halt to these military operations.” Most Western governments and the U.N. have also condemned the attack and demanded a retreat. Trump, however, told Hifter almost the opposite, the White House said Friday.

A militia leader who has given himself the title of Field Marshal, Hifter, 75, has long sought to portray his fight for power over Libya — including his advance on Tripoli — as a battle against “terrorism.” On Friday, the White House said Trump had called Hifter on Monday to endorse that campaign. Trump called “to discuss ongoing counterterrorism efforts and the need to achieve peace and stability in Libya,” the White House said. “The president recognized Field Marshal Hifter’s significant role in fighting terrorism and securing Libya’s oil resources, and the two discussed a shared vision for Libya’s transition to a stable, democratic political system.”

Analysts said Trump’s endorsement would embolden Hifter and hamper U.N. efforts to call for a cease-fire.

The policy reversal came as a surprise in part because Hifter’s forces also appear to be losing ground. His promises of a quick victory have proved false, and his forces appear outmaneuvered. Most analysts say he has little hope of exerting his authority over all of Libya any time soon, so his continued campaign may only prolong the instability.

In the meantime, the battle for Tripoli has diverted the attention of most of the Libyan militias, which had been combating ISIS fighters, said Frederic Wehrey, a Libya expert at the Carnegie Endowment for International Peace.

“It is nuts,” Wehrey said of Trump’s statement. “Even judging by the hard-nosed American goals of stabilizing the flow of oil and combating terrorism, this is completely shocking.”