GUANTANAMO BAY, CUBA - JUNE 27:  (EDITORS NOTE: Image has been reviewed by the U.S. Military prior to transmission.) A watch tower is seen in the currently closed Camp X-Ray which was the first detention facility to hold 'enemy combatants' at the U.S. Naval Station on June 27, 2013 in Guantanamo Bay, Cuba.The U.S. Naval Station at Guantanamo Bay, houses the American detention center for 'enemy combatants'. President Barack Obama has recently spoken again about closing the prison which has been used to hold prisoners from the invasion of Afghanistan and the war on terror since early 2002.  (Photo by Joe Raedle/Getty Images)
Joe Raedle/Getty Images South America/Getty Images
GUANTANAMO BAY, CUBA - JUNE 27: (EDITORS NOTE: Image has been reviewed by the U.S. Military prior to transmission.) A watch tower is seen in the currently closed Camp X-Ray which was the first detention facility to hold 'enemy combatants' at the U.S. Naval Station on June 27, 2013 in Guantanamo Bay, Cuba.The U.S. Naval Station at Guantanamo Bay, houses the American detention center for 'enemy combatants'. President Barack Obama has recently spoken again about closing the prison which has been used to hold prisoners from the invasion of Afghanistan and the war on terror since early 2002. (Photo by Joe Raedle/Getty Images)
Now playing
01:04
Obama: Guantanamo Bay undermines national security
President Barack Obama speaks on counterterrorism at MacDill Air Force Base in Tampa, Florida on December 6, 2016.
MANDEL NGAN/AFP/Getty Images
President Barack Obama speaks on counterterrorism at MacDill Air Force Base in Tampa, Florida on December 6, 2016.
Now playing
02:35
Obama takes action before Trump takes office
Obama Tampa Fl
CNN
Obama Tampa Fl
Now playing
01:44
Obama gives final national security address
Guantanamo Bay
Guantanamo Bay
Now playing
01:46
Pentagon announces transfer of Guantanamo detainees
Donald Trump Miami Herald
The Miami Herald
Donald Trump Miami Herald
Now playing
02:07
Trump 'fine' with trying US citizens in Gitmo
A group of detainees kneels during an early morning Islamic prayer in their camp at the U.S. military prison for "enemy combatants" on October 28, 2009 in Guantanamo Bay, Cuba.
John Moore/Getty Images
A group of detainees kneels during an early morning Islamic prayer in their camp at the U.S. military prison for "enemy combatants" on October 28, 2009 in Guantanamo Bay, Cuba.
Now playing
03:26
Official: 15 freed Gitmo detainees targeted, killed Americans
The last British resident held at Guantanamo is returning to the UK
The last British resident held at Guantanamo is returning to the UK
Now playing
02:16
Why Guantanamo Bay is still open (2015)
CNN
Now playing
01:02
Bernie Sanders: We should close Guantanamo Bay
sc dem town hall Hillary Clinton Guantanamo closure 5_00001207.jpg
CNN
sc dem town hall Hillary Clinton Guantanamo closure 5_00001207.jpg
Now playing
01:16
Clinton: I supported closing Guantanamo for a long time
UK Detainee Gitmo Release - INTV_00000000.jpg
AFP/Getty Images/MCT
UK Detainee Gitmo Release - INTV_00000000.jpg
Now playing
04:38
Last British detainee released from Guantanamo after 13 years
An American flag flies over Camp 6 in June 2013.
Joe Raedle/Getty Images/File
An American flag flies over Camp 6 in June 2013.
Now playing
01:34
Military assesses stateside jails for Gitmo detainees
Muslim detainees kneel during early morning prayer on October 28, 2009.
John Moore/Getty Images/File
Muslim detainees kneel during early morning prayer on October 28, 2009.
Now playing
02:36
Will released Gitmo prisoners fight against the U.S.?
Now playing
02:07
Time is up for Bergdahl exchange prisoners

Story highlights

Bernie Sanders criticized a 2007 vote Hillary Clinton cast on the detention center at Guantanamo Bay

But Sanders cast a similar vote two years later, blocking President Barack Obama's move to close the facility

Obama delivered his blueprint Tuesday for the controversial military prison's closure.

(CNN) —  

Bernie Sanders attacked Hillary Clinton’s record on the detention center at Guantanamo Bay on Tuesday, just after President Barack Obama delivered his blueprint for the controversial military prison’s closure.

But Sanders himself has voted against shuttering the U.S. military facility in Cuba.

And unlike Clinton, he has not signed on as a cosponsor to legislation that would have led to the closure of the facility, otherwise known as Gitmo.

The U.S. military prison has long been a hot-button political subject, and prominently surfaced in the 2008 election, when Obama promised to shut it down. Obama’s latest move to close it triggered quick backlash from Republican presidential contenders, making it a central focus on the 2016 campaign trail as well.

“Keeping this facility open is contrary to our values,” Obama said Tuesday in short remarks at the White House. “It undermines our standing in the world. It is viewed as a stain on our broader record of upholding the highest standards of rule of law.”

Both Democratic candidates have agreed with Obama’s stance on the military prison in recent years.

But Sanders took a shot at Clinton on Tuesday as he praised Obama’s latest move.

“I am encouraged to see that the President is sending Congress a plan to shut down the Guantanamo Bay prison. As I have said for years, the prison at Guantanamo must be closed as quickly as possible,” Sanders said in a statement, noting that he visited the prison during a 2014 trip to Cuba.

He then took a shot at Clinton, saying, “Others, including my opponent, have not always agreed with me.”

Both Sanders and Clinton have raised questions about just what happens to the detainees held there in the past, their Senate records show.

In a news release Tuesday morning, the Sanders campaign said, “Sanders was one of only three senators to vote in 2007 against barring the transfer of Guantanamo detainees to America. Then-Sen. Hillary Clinton voted for the amendment that kept the prison open.”

That appears to be a reference to a 2007 non-binding “sense of the Senate” measure stating that Guantanamo Bay detainees “should not be released into American society, nor should they be transferred stateside into facilities in American communities and neighborhoods.”

Also opposing that measure was Sen. Dianne Feinstein, D-California, who that year authored legislation that would have closed the Guantanamo Bay facility and directed detainees there to be transferred to a U.S. detention facility, to an international tribunal or to another country for legal proceedings there.

Clinton co-sponsored that legislation – Sanders did not.

Two years later, in 2009, with Clinton serving as Obama’s secretary of state, Sanders broke with his fellow Vermont senator Patrick Leahy, a Democrat, on another Guantanamo Bay-related measure.

That vote, like the one Sanders criticized Clinton for casting, was overwhelming – a 90-to-6 vote to block Obama’s request for funds to shutter the facility in Cuba until the President laid out plans for what to do with the then-240 detainees there.

Sanders was among the 90 opponents of Obama on that measure; Leahy was among the six supporters.

Sanders’ spokesman did not respond to CNN’s requests for an explanation of his campaign’s criticism of Clinton, or of that 2009 vote. Clinton has not attacked Sanders’ record on Guantanamo Bay.

Clinton, before departing the State Department, had urged Obama to close the facility.

“I remain a strong advocate of your policy to close the Guantanamo Bay detention facility (GTMO) responsibly and to ensure U.S. detention policy and practice for terrorism suspects are consistent with U.S. values and do not strengthen our enemies,” Clinton wrote in the memo.