WASHINGTON — President Trump effectively blew up negotiations with Democratic leaders over a plan to rebuild the nation’s highways, airports and other infrastructure on Tuesday night, insisting that they put the idea aside until Congress approves a new trade pact with Mexico and Canada.

The surprise demand came on the eve of a White House meeting scheduled for Wednesday at which Mr. Trump was to host Speaker Nancy Pelosi of California and Senator Chuck Schumer of New York, the Democratic leader, to discuss a construction package he has targeted at as high as $2 trillion.

“Before we get to infrastructure, it is my strong view that Congress should first pass the important and popular U.S.M.C.A. trade deal,” Mr. Trump wrote in a letter to Ms. Pelosi and Mr. Schumer, using the initials for the United States-Mexico-Canada Agreement. “Once Congress has passed U.S.M.C.A.,” he added, “we should turn our attention to a bipartisan infrastructure package.”

The president’s abrupt shift came only three weeks after he agreed with Ms. Pelosi and Mr. Schumer to pursue an ambitious rebuilding plan that, if approved, would be the most significant bipartisan achievement of his presidency. Republicans and Democrats have agreed for years that the country’s bridges, railroads, broadband and other structures are badly fraying and in need of repair and improvement.