Former President Obama had a plan to validate the 2016 election in the event that then-candidate Donald Trump lost and challenged the results.

Obama administration officials told New York magazine that a bipartisan plan was in place just in time for the election to certify the results and reveal the intelligence community’s claims that Russian interference supported Trump’s candidacy.

Such a measure was devised after Trump said the election was “rigged” and joked on the campaign trail that he wouldn’t accept the election results if he lost.

“I will totally accept the result of this great and historic presidential election,” he said. “If I win.”

The plan to validate the election involved former secretaries of state Colin Powell and Condoleezza Rice. Former presidents and congressional Republicans also participated in the plan, the outlet reported.

Ben Rhodes, a former top aide of Obama, told the magazine that the administration feared Trump wouldn’t accept the election result had Hillary Clinton won.

“It wasn’t a hypothetical,” he said. “Trump was already saying it on the campaign trail.”

Jen Psaki, communications director for Obama, minimized the plan’s significance, saying it just one of a number of “red-teaming” discussions about the potential fallout following the 2016 election, including pro-Trump protests and political division.

She said that Obama’s unpopularity among “a portion of the population” meant there was a need for a plan to validate the election.

“For them, just having him say the election was legitimate was not going to be enough,” she said.

“I don’t think there is any indication to suggest that if that’s where things headed, [Trump] would accept it,” Psaki added. “He’s laying the groundwork for delegitimizing the process now — questioning our institutions, attacking their leadership. This is all fodder for his supporters to work with in the event that things go down a dark path for him.”