Members of the Obama administration, along with the top House Democrat, applauded Iran for releasing 10 U.S. Navy sailors who unintentionally strayed into Iranian territorial waters on Tuesday, while Republican leaders used the incident as fodder to bash President Barack Obama.

The American sailors, including one female service member, were picked up by Iranian officials after their two small boats allegedly drifted into Iranian territorial waters near Farsi Island on Tuesday, reports ABC News. The sailors were then temporarily held in an Iranian base on the island in the Persian Gulf, before being released unharmed Wednesday morning.

According to the U.S. military, mechanical trouble with one of the boats caused them to drift off course.

Following their release, White House chief of staff Denis McDonough said new lines of communication established with Iran during the negotiations over the U.S.-Iran nuclear deal helped the countries develop diplomatic ties and ultimately led to the quick release of the sailors.

U.S. Secretary of State John Kerry, who developed a working relationship with Iranian Foreign Minister Mohammad Javad Zarif during the nuclear negotiations, also issued a statement thanking Iran for freeing the sailors and noting that the deal was key to getting the sailors released.

"That this issue was resolved peacefully and efficiently is a testament to the critical role diplomacy plays in keeping our country safe, secure and strong," Kerry said in a statement on Wednesday, according to The Associated Press.

Likewise, House Minority Leader Rep. Nancy Pelosi applauded Iran's release of the sailors, saying the matter "was resolved in a matter of hours, and I think that that's record time for all of the, shall we say, apprehension of people who may or may not have been in their waters." She added the negotiations over the historic nuclear deal helped smooth the way to the "speedy resolution."

On the other hand, several Republican presidential hopefuls denounced the Obama administration over Iran's detention of U.S. Navy soldiers.

"You know why these things happen? Because they know they can get away with it while President Barack Obama is in office," Florida Sen. Marco Rubio claimed while speaking about the captured sailors at a campaign event in South Carolina. He also called the nuclear deal "ridiculous" and vowed to reverse it if he is elected president.

Meanwhile, New Jersey Gov. Chris Christie called the sailors' temporary detention by Iran "outrageous" and argued that it shows "how little they respect [Obama] and how weak this president truly is."

"This is why the American people are so nervous, why they are scared and anxiety-ridden over our place in the world and what it means for the purpose our own safety and the safety of our fellow citizens," Christie added.