President Trump arrives at a rally at Resch Center Complex in Green Bay, Wis., on Saturday, April 27, 2019. (Andrew Harnik/AP)

In October 2015, then-candidate Donald Trump railed against his opponents and the political committees raising huge sums to try and boot him out of the primaries.

“They’re in total cahoots with their [super] PACs, which they’re not allowed to be,” Trump told The Washington Post at the time. “They’re all in total cahoots. They put their friends in there. One good thing about me: I’m not.”

But on Tuesday, President Trump made a sharp about-face: He publicly endorsed America First Action, a super PAC run by his allies that aims to raise millions of dollars to ensure his second term.

“There is one approved outside non-campaign group, America First Action, which is run by allies of the President and is a trusted supporter of President Trump’s policies and agendas,” the campaign said in a statement Tuesday.

Candidates and the independent super PACs that support them have increasingly found ways to work together without breaking laws barring outright coordination.

But the Trump reelection campaign’s statement appeared to go further than any other.

The statement came in response to alleged efforts by a former campaign aide accused of misleading donors about how they are spending money.

It attracted attention from advocates for greater campaign finance restrictions, who pointed to it as the latest sign of the erosion of the independence that super PACs are supposed to maintain from the candidates they support.

The Supreme Court has held that the government has an interest in restricting large campaign contributions to prevent corruption. When it opened the door to super PACs with its seminal Citizens United decision in 2010, the court wrote that unlimited donations for independent political spending could not be corrupting because it would not be coordinated with candidates.

But Trump, advocates said, is taking advantage of a legal gray area that candidate committees and super PACs have used to stretch the legal boundaries of how much they can work in tandem with each other.

Under federal law, outside groups must act “totally independently,” and political activity such as ads promoting the candidates or attacking their opponents cannot be made “in cooperation, consultation or concert” with a candidate.

There is a lot of room to maneuver around that.

For example, candidates can appear at super PAC fundraisers, as long as they do not solicit more than $5,000.

The campaign cannot share private strategies with a super PAC and a super PAC cannot share information that could be considered a contribution to the campaign. But the two sides can share information publicly through the media, on their websites or through social media, which can help guide each other’s plans.

Trump’s campaign said it is simply stating a fact: that America First Action — the main pro-Trump super PAC — is a supporter of Trump’s agenda and policies. The statement is not a solicitation for donations, the campaign said.

“While America First is an independent organization, we are honored to have the trust and confidence of President Trump and to welcome him, Vice President Mike Pence, Donald Trump Jr., and other senior officials as specially invited guests at our events,” Brian O. Walsh, president of America First Action, said in a statement.

Walsh added that his group is “unwavering in our commitment to seeing him [Trump] reelected in 2020.”

The Trump campaign’s statement underscores how much Trump has come to embrace the big-money donor world he denounced when he was running for president the first time.

The “drain the swamp” candidate said on the 2016 campaign trail that the chase for wealthy backers who give millions to super PACs made candidates “psychologically” beholden to donors and promised it was “not going to happen with me.”

Since taking office, Trump and Pence have appeared at America First Action fundraisers. The super PAC raised nearly $40 million in the 2018 cycle to support the president’s policies and his allies in Congress.

When The Post first reported in October 2015 that Trump had connections to a super PAC that was collecting large checks to support his candidacy, then-campaign manager Corey Lewandowski adamantly denied Trump had given the group the green light.

“Unlike other campaigns, we don’t have a quote-unquote designated super PAC that we tell people to give money to,” he said at the time, adding: “I want to be crystal clear. There is no sanctioned super PAC.”

Now, America First Action is led by Linda McMahon, a Trump donor and former Cabinet member. Several former Trump campaign aides, including Lewandowski, joined the super PAC over the past two years. In addition, many of these former aides’ consulting companies have been paid for their work with the super PAC.

Some critics say the campaign’s statement is a sign that the super PAC is not truly independent of the Trump campaign. Campaign Legal Center, which supports greater campaign finance restrictions, plans to file a complaint in the coming days with the Federal Election Commission claiming the statement is indeed a solicitation and that the campaign should have added solicitation qualifiers as required by the law.

But others say while the campaign’s wording is blunt and bold, it is not a clear violation of restrictions on coordination or solicitations. Previous presidential candidates from both parties have worked closely with super PACs supporting them, including Hillary Clinton, Jeb Bush and Mitt Romney — without suffering any repercussions from the FEC.

Richard Hasen, elections law expert at the University of California Irvine, said the Trump campaign’s statement points to the weakness of current limits on coordination, because there are many ways that campaigns and super PACs have been able to collaborate legally.

“The bottom line is that the coordination rules are a joke, and you can get into a whole lot of coordination without breaking the law,” Hasen said. “That suggests that the law maybe needs to be changed.”

Michael Toner, former Republican chairman of the Federal Election Commission, noted that America First Action is widely known as the main pro-Trump super PAC.

“It’s not exactly a state secret that America First Action PAC supports the Trump campaign and the Trump administration, nor is it a secret that the Trump Campaign has appreciated the PAC’s support in the past,” Toner said. “I wouldn’t read anything more or less into the Trump campaign’s statement.”