WASHINGTON — President Trump said on Wednesday night that “it’s crazy” that the United States spends about $13 million a year for each terrorism suspect held at the detention center at Guantánamo Bay, Cuba, and added that he would search for alternatives.

“I know about that,” Mr. Trump told reporters aboard Air Force One as he flew back to Washington after a three-day campaign trip to New Mexico and California. “I think it’s crazy. It costs a fortune to operate, and I think it’s crazy.”

But he would not say whether he would consider closing the prison at Guantánamo. “We’re looking at a lot of things,” he said without elaborating. Instead, he pointed out that his predecessor tried and failed to shutter the prison. “Look, President Obama said that Guantánamo Bay would be closed, and he never got it done.”

The president’s comments came in reaction to a report in The New York Times tabulating the expense of housing the 40 prisoners remaining at Guantánamo, who include the men accused of plotting the Sept. 11, 2001, attacks. According to the report, the government spent more than $540 million last year to hold the prisoners, including pay for the military guards, the cost of the war court and related construction expenses.