Defense Secretary Robert M. Gates said yesterday that the Pentagon may have to build a new facility to house detainees from the military prison at Guantanamo Bay, to hedge against political opposition around the country to the incarceration of the inmates in existing federal or military facilities in the United States.

"I fully expect to have 535 pieces of legislation before this is over saying, 'Not in my district, not in my state,' " Gates said, referring to the number of senators and representatives in Congress. He said the Pentagon wants to have $50 million at hand in case it has to build a prison on short notice.

In January, President Obama ordered the closure of the detention center at Guantanamo Bay, Cuba, within a year. Gates said the facilities, which cost tens of millions of dollars to construct, are likely to be "mothballed....