WASHINGTON — A phone call from US President Donald Trump last week ended a nearly two-month-long review of the nation’s biofuels program, three sources familiar with the matter said, with the White House siding in favor of oil refiners over corn growers.

Trump gave Andrew Wheeler, head of the US Environmental Protection Agency, the green light for the regulator to announce it had granted 31 small refinery exemptions out of the 40 applications, saying he wanted the issue off his desk, the sources said.

Trump’s call triggered a flurry of action within the EPA, leading up to a surprise Friday afternoon announcement, after weeks of negotiations between US government agencies failed to make progress in addressing farmers’ concerns.

“The president has heard from all sides and in the end he has had enough of it. He called Wheeler and gave him the green light,” a source familiar with knowledge of the matter said.

The White House has sought to make changes to the nation’s biofuels laws since the beginning of Trump’s administration in early 2017, but found themselves caught between the powerful oil and corn lobbies, both of whom have allies in Washington in Trump’s Republican Party.

The debate underscores the rising political importance of the US Renewable Fuel Standard, a more than a decade-old federal policy that requires refineries to blend corn-based ethanol into their gasoline or buy credits from those that do.

Since Trump took office, the EPA has more than quadrupled the number of waivers it has granted to refineries, including some operated by giants Exxon Mobil (XOM.N) and Chevron Corp (CVX.N), saving the oil industry hundreds of millions of dollars, but enraging farmers who claim the exemptions threaten demand for one of their staple products.

Refiners dismiss the argument, saying ethanol demand has not been affected.

The White House declined to comment for this story. The EPA did not immediately respond to requests for comment.

Trump had ordered the revamp of the waiver program in June, after hearing from angry farmers during a trip to Iowa, the nation’s top ethanol producing state. Even though the corn lobby seemed to have the upper hand in early talks, the oil industry’s efforts eventually gained more traction, industry sources have told Reuters.

Iowa is a swing state that Trump carried in 2016 and is potentially crucial for his re-election efforts next year. Farmers in the state have also chafed under Trump’s trade war with China that has sapped demand for agriculture products.

Farmers slammed last Friday’s decision, saying the Trump administration was bailing out the oil industry at a time when U.S. farmers were suffering due to his trade war with China. The refining industry welcomed the move, saying the waivers are lawful and help shield small refiners from the burdensome cost of compliance with RFS.