Just four years ago, Marco Rubio was gearing up to run for president with an inclusive and sunny message designed to capture the imagination of a modernizing Republican Party - and maybe even the country.

Those days, and that candidate, are long gone.

Like many Republicans, the second-term Florida senator has sounded more and more like President Donald Trump since the 2016 election - striking a notably darker and foreboding tone while adopting some of Trump's slash-and-burn political tactics and controversial positions.

Since the Nov. 6 midterm elections, Rubio has stood on the front lines of the partisan war here in Florida over his state's recount, storming social media with criticism of Democrats and seizing on incomplete information to raise doubts about the intentions of elections officials. He also penned a Wall Street Journal op-ed declaring that "Trump Is Right About Nationalism," embracing a term fraught with racial and historical baggage, though he argued it is not about ethnicity.

"I do think he's evolving," said Brian Ballard, a Rubio associate and Republican donor in Florida. "I have noticed his tweets are much more in-your-face."

His latest transformation has revived criticism among some Republicans that Rubio is a politician without a core - a shape-shifter who has bounced from tea party insurgent to sunny moderate to Trump acolyte with little compunction.

"Rubio is a survivor who constantly reassesses the political environment," said Dan Eberhart, a donor to Florida Republican Gov. Rick Scott, who sealed his victory in the Senate race Sunday when Democratic Sen. Bill Nelson conceded defeat at the conclusion of a manual recount.

Rubio has been at the center of other moments when the GOP reset itself. He won his Senate seat in 2010, after defeating an establishment Republican in the tea party wave. Then in 2013, he shifted to a moderate posture by helping lead a failed push to pass a comprehensive immigration bill. He has since distanced himself from that compromise while adopting a harsher posture on border issues.

Nearing the halfway point of Trump's first term, other prominent Republicans have undergone a similar metamorphosis. Sen. Lindsey Graham, R-S.C., who once called Trump "a race-baiting, xenophobic, religious bigot" on CNN, has been become one of the president's most ardent defenders on Capitol Hill.

And departing United Nations Ambassador Nikki Haley, who warned of deadly consequences in 2016 if Trump did not change his rhetoric, said Trump should not be blamed in the aftermath of the mass killing at a Pittsburgh synagogue.

Rubio is an ambitious politician in the nation's largest swing state, where Trump and his allies have now had success in two straight elections. Republican former congressman Ron DeSantis, whose political ascent has stemmed largely from his enthusiastic support of the president, won the governor's race after a machine recount of ballots. In the Senate race, Trump encouraged Scott to run.

Rubio's office declined to make him available for an interview, but people close to him offered several possible explanations for his current approach: He will not be on the ballot until 2022 and feels liberated to speak his mind; he feels that he needs to channel the message of his 2010 campaign more aggressively; and he is looking to stay relevant in a party in which Trump has won widespread support.

His relationship with Trump has improved since they were bitter rivals in the 2016 presidential primary, and they found common cause in the Florida recount. Trump took to Twitter to accuse Democrats of trying to "steal" the election and made baseless allegations of voter fraud. Rubio jumped on board with similar arguments.

"I don't know what's in this sealed box found this morning by #BrowardSheriff. But this dysfunction in #BrowardElections is not acceptable," he tweeted four days after the election, with a photo of a crate labeled "provisional ballot box."

The box contained supplies, the county supervisor of elections said. "Maybe this box found this morning has office supplies in it. But if it contains just a single vote, it should have been handled in accordance with the law, NO MATTER WHO IT WAS A VOTE FOR," Rubio tweeted later.

David Jolly, a former Republican congressman from Florida, expressed concerns about the tactics Rubio, Trump and Scott have used to stoke suspicion about the electoral proceedings. "I think it reflects that the party has moved to listen to darker angels not better angels," said Jolly, who recently became an independent.

Three days after his tweets about the box in Broward County, Rubio used a football analogy to describe lawsuits Democrats had filed. "Imagine if NFL team was trailing 24-22 but in final seconds hits a 3 pt kick to win. Then AFTER game lawyers for losing team get a judge to order rules changed so that last second field goals are only 1 point," he tweeted. "Well that's how democrat lawyers plan to steal #Florida election."

Miami-Dade County Mayor Carlos Giménez, a Republican, said, "He obviously has learned that it's been effective for the president to tweet. . . . I guess imitation is the best form of flattery."

Alex Conant, a former top Rubio aide, said Rubio ran his own Twitter account before he ran for president and always intended to take it back.

"He's always believed that social media only works if it's authentic and that people can tell when a staffer takes over a politician's Twitter handle," Conant said. "I think what you're seeing on Twitter is the real Rubio."

Rubio ran a highly scripted, tightly choreographed campaign for president - a strategy that was used against him to devastating effect. In a televised debate, GOP rival Chris Christie lambasted him for repeating an oddly phrased talking point four times during a debate - "let's dispel with this fiction that Barack Obama doesn't know what he's talking about" - a moment that branded him as robotic in front of a national audience.

The Florida senator also found little success with his aspirational campaign theme. Efforts to cast himself - a child of Cuban migrants with blue-collar jobs - as the embodiment of the American Dream and a youthful voice for a new generation were drowned out by Trump's darker pitch.

After trying to sidestep Trump, Rubio finally engaged him late in the campaign, calling him a "con man" and lobbing personal attacks he later said he regretted and were embarrassing to his daughters. As it became clear his campaign was on its last legs, Rubio said it was "getting harder every day" to commit to supporting the GOP nominee. Trump, meanwhile, repeatedly and devastatingly referred to him as "Little Marco."

Their relationship shifted after Trump became president. They worked together on a new Cuba policy. Rubio found common ground with Ivanka Trump, the president's daughter and senior adviser, on family leave. Donald Trump Jr. frequently retweeted the senator during the recount.

Another shift is Rubio's suddenly warmer relationship with Scott following past tensions between their camps, which flared up earlier this year. After the election, Rubio jumped at the chance to get involved on Scott's behalf, joining a call with reporters hosted by the Scott campaign. Asked whether Scott should use his powers as governor to remove Broward County Supervisor of Elections Brenda Snipes, a controversial Democrat, Rubio replied, "I certainly think that once this is all done, she's certainly a candidate for removal."

He added, "Whether that will happen while Gov. Scott's in office or not, obviously that's not my determination to make." A Scott lawyer quickly followed up by adding that the governor was not considering removing her.

"He's done a 180," said Eberhart, the Scott donor. "There was a lot more distance between them a year ago."

Rubio has broken with Trump on some occasions, but there have been limits to his willingness to stray.

At the start of Trump's presidency, Rubio expressed reservations about his pick for secretary of state, Rex Tillerson. Ultimately, however, he voted for Tillerson.

And earlier this year, Rubio emerged as one of the most vocal Republican critics of Trump's policies on China.

But even his opposition to the president on that issue served as an acknowledgment of how Trump had defined the terms of political combat. In May, Rubio used a twist on a Trumpian turn of phrase to attract attention to his critique.

"This is #NotWinning," he tweeted.

The Washington Post's Beth Reinhard in Lauderhill, Fla., contributed to this report.