"When you get Rand Paul on your side, it has to be positive, that I can tell you," President Trump said at Thursday's signing ceremony for his new executive order easing Obamacare rules. "Boy."

Trump and the independent-minded Kentucky Republican senator have been on the same side more than ever seemed likely during the presidential campaign.

"Rand and the president are both outsiders and both politically savvy," said a Republican strategist. "It's really not that surprising that they would find their way to working together."

It wasn't always so cordial. As the Republican primaries raged, Paul described Trump as an "orange-faced windbag" and a "delusional narcissist," comparing the future president's insults to junior high school taunts. Trump once opened a GOP by declaring, "First of all, Rand Paul shouldn't even be on the debate stage."

Trump was a brash New York businessman and reality TV star, Paul a cerebral Kentucky eye doctor turned Tea Party darling. Trump was loud, Paul soft-spoken.

Even back then, however, the odd couple had some common ground. They were the two Republican presidential candidates who had opposed the Iraq war the longest (even if Trump was known to exaggerate his antiwar bona fides). They also both cited it as an example of how pursuing regime change in the Middle East, especially by overthrowing relatively secular dictators, sowed chaos and frequently fanned the flames of radical Islam.

Paul has used Trump's "America first" rhetoric to try to rally Republicans around his own foreign policy preferences while also urging the president to become more consistent on that front.

"One of the things I like most about President Trump is his acknowledgement that nation building does not work and actually works against the nation building we need to do here at home," Paul wrote. "With a $20 trillion debt, we don't have the money to do both."

When Trump made unsupported claims that former President Obama had "wiretapped" Trump Tower, Paul quickly seized on it as a new way to argue against surveillance and the national security state.

"This was a witch hunt that began with the Obama administration, sour grapes on the way out the door," Paul said of the reports that former national security adviser Susan Rice requested the "unmasking" of Trump campaign officials. "They were going to use the intelligence apparatus to attack Trump, and I think they did."

Trump hasn't always followed Paul's lead on these issues, bombing Syria and increasing troop levels in Afghanistan without an updated congressional authorization of force. Paul has also criticized the administration on civil asset forfeiture, with some libertarians unsuccessfully trying to persuade him to oppose Jeff Sessions for attorney general.

Still, Paul often cites Trump when trying to convince the Republican base to be less interventionist abroad. Trump is popular in Kentucky, running slightly ahead of Paul last year.

Perhaps most surprising has been the occasional Trump-Paul alliances on Obamacare. Trump and Paul both undercut leadership's repeal and delay strategy earlier this year. Later, they both supported clean repeal after GOP replacement efforts stalled, bucking criticism from within the party that this was a flip-flop.

One key difference is that Trump has endorsed every Republican healthcare bill that has had a decent chance of passing either chamber, while Paul has often come out against "Obamacare lite" in the Senate. This prompted Trump to blast Paul as a "negative force" on healthcare when the latter opposed the Graham-Cassidy bill, the last healthcare reform attempt by Senate Republicans.

Yet even there, Trump also described Paul as his "friend." He predicted Paul would get on board "for the good of the party." This is light treatment compared to that received by past holdouts like Sens. John McCain, R-Ariz., or Dean Heller, R-Nev. At the end of September, the two joined forces on pushing executive action to ease Obamacare's regulatory burdens.

Paul previously overcame a contentious relationship with Senate Majority Leader Mitch McConnell, a Republican who is also Kentucky's senior senator. In 2010, the two battled as McConnell strongly supported Paul's primary opponent. When Paul won the nomination, two largely put bad feelings aside and worked together.

McConnell even endorsed Paul's presidential campaign, although this was arguably unhelpful against opponents like Sen. Ted Cruz, R-Texas. Trump and McConnell have clashed.

"Sen. Rand Paul considers President Trump a personal friend," said Paul communications director Sergio Gor. "They constantly speak with each other and are on the same page on countless issues. Unfortunately too many of the recent failed proposals have originated from House and Senate leadership and have been far from the ideology that gave the Republicans the majority in Congress."