The United States on Saturday lifted sanctions against Iran and announced that four Americans held prisoner in the country will be returning home, in a whirlwind day of diplomacy that cements President Obama’s engagement with Iran as a pillar of his legacy.

The United Nations’ nuclear watchdog certified Iran has fulfilled its promises to prevent it from building a nuclear weapon, after decades of tensions, years of negotiations and months of work to implement the international nuclear deal reached six months ago.

The State Department confirmed moments later that the nuclear deal is now implemented, thereby lifting a slate of sanctions.

The milestone to fully implement the nuclear accord comes despite heated opposition on Capitol Hill and around the country.

Prominent critics fear that the agreement has only emboldened Iran, by giving its hardline leaders tens of billions of dollars in sanctions relief in exchange for temporary commitments that can easily be broken.

Sen. Marco Rubio (R-Fla.), a Republican presidential candidate, warned Saturday that the deal “rewards bad behavior.” “By channeling this money to Tehran and giving the mullahs international legitimacy, the Obama administration is fueling the greatest growth in Iranian power since the Islamic Republic was established in 1979,” Rubio wrote on RedState

Hours earlier Saturday, Iranian officials announced that four American prisoners held in Iran — including a Washington Post reporter and a Christian pastor — would be freed , in exchange for seven prisoners in the U.S.

The prisoner swap was the result of 14 months of secret parallel negotiations between Kerry and his counterpart in Iran, U.S. officials said.

An agreement to finalize the swap on the same day that sanctions are lifted against Iran was reached just “several days ago,” one senior administration official said.

“A window opened up during the nuclear deal and we wanted to take advantage of that window,” the official added, insisting that discussions about the prisoners were always separate from the nuclear talks.

“We are dealing in the context of the most diplomatic breakthrough with Iran in well over 30 years,” the official said. “So why not take the opportunity of that opening to get our people home?”

President Obama has hailed the accord as one of the pillars of his presidency, despite broad skepticism from around the country.

“We built a global coalition, with sanctions and principled diplomacy, to prevent a nuclear-armed Iran,” Obama said during his State of the Union address this week.

In taking steps to halt its nuclear progress, Obama claimed, “the world has avoided another war.”

To meet the IAEA’s certification, Iran had to take a number of steps, including removing the core of its Arak heavy water reactor and filling it with cement.

The country also had to dismantle roughly 13,000 centrifuges and dramatically reduce its stockpile of low-enriched uranium, which was sent to Russia in December.

In exchange, Iran will immediately receive at least $50 billion of its own money that had been held in restricted accounts. Critics say the actual “signing bonus” is much higher, close to $150 billion.

The only sanctions being lifted by the U.S. concern foreign companies doing business with Iran. The American embargo on Iran will remain in place, barring U.S. companies from engaging directly with Iran, with a few small exceptions for passenger aircraft, carpets and pistachios. Additionally, existing U.S. sanctions will remain in place on Iranians connected to the country’s humans rights abuses and support for terrorism. Further sanctions will be issued soon to punish Iran for a pair of ballistic missile tests, the senior administration official said Saturday, though it remains unclear when.

Implementation comes after a tense moment earlier in the week, in which Iran detained 10 American sailors for roughly 16 hours.

The continued imprisonment of four Americans in Iran had been a sticking point for opponents of the agreement.

Last year, Obama got in a memorably heated exchange with a reporter for suggesting that he was " content " to let them languish in a foreign prison.

The administration had long insisted that the nuclear negotiations were meant to achieve one goal — prevent Iran from being able to obtain a nuclear weapon — and not dramatically alter its broader behavior.

However, officials acknowledge that broader engagement between Iran and the rest of the world would be a possible added benefit.

The White House claimed this week that its ability to swiftly bring the 10 sailors home was evidence of that rapprochement. The exchange to free the prisoners appears to be another.

Peter Sullivan contributed to this report.

- Updated at 6:40 p.m.