President Donald Trump's fellow Republicans rebuked him on Wednesday after his threat to shut down the U.S. government over funding for a border wall rattled markets and cast a shadow over congressional efforts to raise the country's debt ceiling and pass spending bills.

"I don't think anyone's interested in having a shutdown," the top Republican in Congress, House of Representatives Speaker Paul Ryan, told reporters on Wednesday in Hillsboro, Oregon, where he visited an Intel factory.

Ryan said building a wall along the country's border with Mexico to deter illegal immigration was necessary, but added that the government did not have to choose between border security and shuttering operations.