In this March 16, 2018, file photo. National security adviser H.R. McMaster waves as he walks into the West Wing of the White House in Washington. President Donald Trump announced on Twitter on March 22, 2018, that McMaster is being replaced by former U.N. Ambassador John Bolton. (AP Photo/Susan Walsh, File)

WASHINGTON (AP) — President Donald Trump is replacing national security adviser H.R. McMaster with John Bolton, a former U.S. ambassador to the United Nations.

Trump tweets that McMaster has done “an outstanding job & will always remain my friend.” He says Bolton will take over April 9.

Trump has repeatedly clashed with McMaster, a respected three-star general, and talk that McMaster would soon leave the administration had picked up in recent weeks.

His departure follows Trump’s dramatic ouster of Secretary of State Rex Tillerson last week.

It also comes after someone at the White House leaked that Trump was urged in briefing documents not to congratulate Russian President Vladimir Putin about his recent re-election win. Trump did it anyway.

McMaster was brought in after Trump’s first national security adviser, Michael Flynn, was dismissed.