WASHINGTON — House Speaker Mike Johnson on Monday night visited former President Donald Trump at his Mar-a-Lago estate in Florida, according to a person familiar with the meeting, making his first pilgrimage to see the Republican presidential front-runner since his surprise elevation to the top post in the House last month.

The visit to Trump’s Florida home came at a tricky moment for the inexperienced speaker, who is already facing criticism from hard-right allies livid at him for teaming with Democrats last week to pass legislation to avert a government shutdown. The person confirmed the private meeting on the condition of anonymity.

Trump’s influence over spending fights in Washington may be limited, but Johnson’s decision to meet with him within weeks of his election as speaker is a sign he knows he cannot afford to have Trump weighing in publicly against him and hardening right-wing opposition to his leadership.

Johnson has taken other steps to ingratiate himself to the far right and cement his hold on the gavel.

Late last week, he announced he was publicly releasing surveillance video of the Jan. 6, 2021, attack on the Capitol, a step far-right lawmakers and activists have been demanding as they seek to undercut the facts about how supporters of Trump violently stormed the complex seeking to overturn his electoral defeat.

Since Trump’s election in 2016, Republican congressional leaders have had to cultivate some kind of working relationship with him.

But Johnson, who defended the former president in two Senate impeachment trials and played a lead role in trying to help him invalidate the 2020 election results, is positioning himself as the first speaker to be in complete lock step with the former president.

The meeting at Mar-a-Lago was reported earlier by Punchbowl News.

Last week, Johnson officially endorsed Trump — a move former Speaker Kevin McCarthy resisted even while proclaiming that the former president would be the Republican nominee and would be reelected.

“I endorsed him wholeheartedly for reelection in 2020, and traveled with his team as a campaign surrogate to help ensure his victory,” Johnson said in a statement to The New York Times. “I have fully endorsed him once again.”

The endorsement came in response to a report by the Times that in 2015, Johnson had posted on social media saying that Trump was unfit to serve and could be a danger as president.

“The thing about Donald Trump is that he lacks the character and the moral center we desperately need again in the White House,” Johnson wrote in a lengthy post on Facebook on Aug. 7, 2015. “I am afraid he would break more things than he fixes.”

Johnson, who until last month never held a top-tier position in leadership, was in Florida for a fundraising trip. He made a stop at Mar-a-Lago for an event for Rep. Gus Bilirakis, R-Fla., according to the person familiar with the meeting with Trump.