White House aides on Tuesday accused some Republican lawmakers objecting to the controversial prisoner exchange that freed Sgt. Bowe Berghdal of hypocrisy on social media.

The administration has come under fire for the swap, which freed five Taliban militants imprisoned at Guantanamo Bay.

Critics said that the White House enabled the release of hardened terrorists and some lawmakers charged the administration with violating a federal law requiring 30 days notification before detainees are transferred from Guantanamo Bay.

Controversy has also erupted over Berghdal's behavior prior to his capture by the Taliban in Afghanistan, with some lawmakers accusing him of desertion. According to fellow soldiers, he intentionally walked away from his campsite, leaving a note indicating that he no longer believed in the U.S. mission there.

But on Twitter Tuesday, White House officials noted instances where some of those same GOP critics previously voiced support for efforts to free Berghdal.

Sen. John McCainJohn Sidney McCainMcCain rips Trump for attacks on press NSA spying program overcomes key Senate hurdle Meghan McCain says her father regrets opposition to MLK Day MORE (R-Ariz.) has criticized the release of Gitmo detainees, telling CBS News he found it "disturbing that these individuals would have the ability to re-enter the fight, and they are big, high-level people, possibly responsibly for the deaths of thousands."

The Arizona lawmaker also told BuzzFeed that the decision to bring Berghdal home was "ill-founded" and a "mistake" that endangered American servicemen.

But White House spokesman Eric Schultz noted instances where McCain had previously said he was "inclined to support" a prisoner exchange.

White House director of progressive media Jesse Lee also highlighted the Arizona senator's stated support for a swap of Guantanamo prisoners.

The White House staffers also targeted Sen. Kelly AyotteKelly Ann AyotteLessons from Alabama: GOP, throw out the old playbook The Hill's 12:30 Report Explaining Democratic victories: It’s gun violence, stupid MORE (R-N.H.), who told a local newspaper that "the administration's decision to release these five terrorist detainees endangers U.S. national security interests."

And Sen. James InhofeJames (Jim) Mountain InhofeEPA's Pruitt: Bring back 'true environmentalism' Tax cut complete, hawks push for military increase Trump meets with oil-state GOP senators on ethanol mandate MORE (R-Okla.), the top Republican on the Senate Armed Services Committee, warned in a statement that the president's move "may have consequences for the rest of our forces and all Americans."

"Our terrorist adversaries now have a strong incentive to capture Americans. That incentive will put our forces in Afghanistan and around the world at even greater risk," he said.

That statement also drew a rebuttal from Schultz.

The online push is only part of the administration's effort to quell criticism over the deal.

Earlier Tuesday, White House press secretary Jay Carney and deputy national security adviser Tony Blinken sat for television interviews where they defended the exchange.

“We do not allow members of the military being held by the enemy to sit and rot,” Carney told CNN.

“The principle at stake here is: Do we, the United States, leave our uniformed members of the military behind when they’ve been captured by the enemy. And the answer is: no. We don’t do that. That’s why the commander in chief acted as he did,” Carney added.

At a joint press conference earlier Tuesday, President Obama argued the deal was the right thing to do.

"Regardless of the circumstances, we still get an American soldier back if he's held in captivity,” Obama said. “Period. Full stop."