WASHINGTON — The Trump administration announced on Tuesday that it would provide up to $12 billion in emergency relief for farmers hurt by the president’s trade war, moving to blunt the financial damage to American agriculture and the political fallout for Republicans as the consequences of President Trump’s protectionist policies roll through the economy.

Unveiled two days before the president is scheduled to visit Iowa, a politically important state that is the nation’s top soybean producer, the farm aid appeared calculated to show that Mr. Trump cares about farmers and is working to protect them from the worst consequences of his trade war.

But the relief money, announced by the Department of Agriculture, was also an indication that Mr. Trump — ignoring the concerns of farmers, their representatives in Congress and even some of his own aides — plans to extend his tit-for-tat tariff wars.

“The actions today are a firm statement that other nations cannot bully our agricultural producers to force the United States to cave in,” Sonny Perdue, the secretary of agriculture, said during a call with reporters to unveil the program.