A Republican-led Senate panel on Thursday narrowly approved legislation that would bar most transfers of terror suspects from the U.S. prison at Guantanamo Bay, Cuba, a major roadblock in President Barack Obama's push to close the detention center.

In a closed-door session, the Armed Services Committee voted 14-12 for the bill sponsored by Sen. Kelly Ayotte of New Hampshire and backed by the panel's chairman, Sen. John McCain of Arizona.

Just as the panel was deliberating, the White House said Obama would veto the legislation if it reaches his desk. The president vowed as a 2008 candidate that he would close the federal prison, but congressional Republicans and some Democrats repeatedly have blocked his efforts during the last six years.

"Our position is that the continued operation of Guantanamo Bay weakens our national security and must be closed," Obama spokesman Eric Schultz told reporters aboard Air Force One. "We believe this bill puts more constraints on a process that should be actually working faster. And so we oppose this legislation and the president would veto it."

When Obama took office six years ago, there were 242 detainees at Guantanamo. Today there are 122. Of those, 54 are eligible for transfer, 10 are being prosecuted or have been sentenced and the cases of the other 58 are being reviewed.

The legislation would extend for two years the ban on transfers of terrors suspects from Guantanamo to the United States. New detainees could be incarcerated at the federal prison and later transferred to the United States.

The measure would suspend the transfer of high- or medium-risk terror suspects from Guantanamo to the U.S. or other countries during Obama's remaining two years in office.

It would allow the transfer of low-risk detainees under previous law and allow the administration to waive any requirement based on national security grounds.

The bill also would legally reinstate a ban on detainees being transferred to Yemen. Many of the remaining detainees at the prison are from Yemen, which is engulfed in turmoil and is home to al-Qaida in the Arabian Peninsula. The United States evacuated its embassy in Yemen this past week.

The measure also requires that the administration provide an unclassified report on the previous activities of terror suspects who remain at Guantanamo.

Ayotte welcomed the panel's action.

"When the administration transfers a Guantanamo detainee, especially those formerly assessed as a high- or medium-risk for reengagement in terrorism, the onus is on the administration to explain openly to the American people what has changed, particularly when nearly 30 percent of former Guantanamo detainees are suspected or confirmed of re-engaging in terrorism," Ayotte said in a statement.

The panel adopted three Democratic amendments, including one sponsored by Sen. Jack Reed of Rhode Island that would allow the temporary transfer of a terror suspect to a Defense Department facility in the U.S. for emergency medical treatment if necessary.

___

Associated Press writer Nedra Pickler contributed to this report.