(CNN) -- President Obama on Thursday defended his decision to shutter the military detention center at Guantanamo Bay, Cuba, saying the prison has made the United States less safe and set back the country's "moral authority."
President Obama wants to close the Guantanamo Bay detention facility, but Congress wants a detailed plan.
"The record is clear: Rather than keep us safer, the prison at Guantanamo has weakened American national security," Obama said during an address on national security at the National Archives in Washington.
"It is a rallying cry for our enemies. It sets back the willingness of our allies to work with us in fighting an enemy that operates in scores of countries. By any measure, the costs of keeping it open far exceed the complications involved in closing it."
He said that the facility resulted in the creation of more terrorists than it detained, and he said that over the last seven years, the system of military commissions at Guantanamo succeeded in convicting "a grand total of three suspected terrorists." Watch Obama weigh in on Guantanamo Bay »
Obama's plans to close Guantanamo have been met with opposition from both sides of the aisle in Congress. Following in the steps of House Democrats, Senate Democrats on Tuesday rejected the administration's request for $80 million to close the facility.
They instead asked that Obama first submit a plan spelling out what the administration will do with the prisoners when it closes the prison. And on Thursday, Obama pledged not to release any Guantanamo Bay detainees who threaten the United States.
"We are not going to release anyone if it would endanger our national security, nor will we release detainees within the United States who endanger the American people," Obama said.
"Where demanded by justice and national security, we will seek to transfer some detainees to the same type of facilities in which we hold all manner of dangerous and violent criminals within our borders -- namely, highly secure prisons that ensure the public safety."
Obama outlined five categories Thursday in which to separate the remaining detainees. Read the full text of Obama's speech
When feasible, he said, those who have violated American criminal laws should be tried in federal courts. Those who violate the laws of war, Obama said, "and are best tried through military commissions."
The third category of detainees is made up of those who we have been ordered released by the courts.
"Let me repeat what I said earlier: This has absolutely nothing to do with my decision to close Guantanamo. It has to do with the rule of law," Obama said.
The fourth category of cases "involves detainees who we have determined can be transferred safely to another country."
Obama said that so far, his review team has approved 50 detainees for transfer. Finally, he said, "there remains the question of detainees at Guantanamo who cannot be prosecuted, yet who pose a clear danger to the American people."
Obama said that "this is the toughest issue we will face. We are going to exhaust every avenue that we have to prosecute those at Guantanamo who pose a danger to our country."
The Senate passed a measure Wednesday that would prevent the detainees from being transferred to the United States. The measure passed with overwhelming bipartisan support in a 90-6 vote. A similar amendment has passed the House.
The moves by the Democratic-controlled Congress are considered a sharp rebuke to Obama.
Immediately after the president's address, former Vice President Dick Cheney critiqued Obama's national security decisions and philosophy, and defended the moves of the Bush administration in an address before the conservative American Enterprise Institute. Sound off on Obama, Cheney speeches
"Good morning -- I mean, good afternoon," he told the audience. Cheney's speech was scheduled for 10:45 a.m. but didn't start until 11:15 because Obama's speech started about 20 minutes late.
Cheney said that the Bush administration "didn't invent" the authority it exercised in the war against al Qaeda and others. He said it was clearly granted by the Constitution and by legislation passed by Congress after the September 11 attacks.
He also said the use of controversial "enhanced interrogation techniques" was a success that saved thousands of lives.
Cheney belittled Obama's decision to close the Guantanamo Bay prison "with little deliberation and no plan." He also said the Bush administration's national security policies successfully delivered numerous "blows" to extremists targeting the United States. Watch Cheney talk, criticize Obama's moves »
Cheney and Obama sharply disagreed. In his speech Thursday, the president slammed the Bush administration for taking America "off course," and defended his decision to ban torture.
Obama said he could not "disagree more" with proponents of so-called enhanced interrogation techniques such as waterboarding.
After September 11, "faced with an uncertain threat, our government made a series of hasty decisions," he said. Watch Obama slam the previous administration »
"I believe that many of these decisions were motivated by a sincere desire to protect the American people. But I also believe that all too often, our government made decisions based on fear rather than foresight; that all too often trimmed facts and evidence to fit ideological predispositions."
Obama said that instead "of strategically applying our power and our principles, too often we set those principles aside as luxuries that we could no longer afford. And during this season of fear, too many of us -- Democrats and Republicans; politicians, journalists and citizens -- fell silent."
"In other words," he said, "we went off course."
On security and transparency, Obama defended his decisions to release Bush-era interrogation memos, but block the release of detainee photos.
Obama said he released the memos because the information had already been made public.
He opposed the release of the photos, which allegedly showed abuse of prisoners, because "nothing would be gained by the release of these photos that matters more than the lives of our young men and women serving in harm's way."
"In each of these cases, I had to strike the right balance between transparency and national security," Obama said.
CNN's Ed Henry, John King and Kristi Keck contributed to this report.