The House late Wednesday rejected an amendment that would have ended all federal funding for Amtrak, the nation's government-subsidized rail service.

Rep. Mo Brooks, R-Ala., brought up the proposal as an amendment to a giant spending bill for fiscal year 2018 that includes transportation funding. He said his language was needed in the face of a national debt that is $20 trillion and growing.

Brooks said from 1971 to 2015, the federal government has subsidized Amtrak by about $78 billion in 2015 dollars and said Congress needs to cut the cord.

"Instead of allowing Amtrak to continue to run up debts ... we should force Amtrak to be self-sufficient," Brooks said late Wednesday night on the House floor. "We must cut Amtrak from the government dole."

Brooks argued that people who travel on Amtrak should be charged enough to cover the cost of their travel and said the government isn't subsidizing many other modes of travel.

But both Republicans and Democrats opposed the language. Rep. Mario Diaz-Balart, R-Fla., argued that it would force Amtrak to shut down, killing off its revenue stream, even as it continued to bear other costs that would make the situation worse.

Late Wednesday night, the House turned away Brooks' amendment in a 128-293 vote. Every Democrat voted against the amendment, and Republicans narrowly favored it.