Motorists wait in line for hours to buy gasoline at a Pemex service station in Zapopan, Jalisco state.

In a double blow for Mexico, credit ratings agency Fitch downgraded the nation's sovereign debt rating on Wednesday, citing risks posed by heavily indebted oil company Pemex and trade tensions, while Moody's lowered its outlook to negative.

The Mexican peso weakened as much as 1.3% on the news.

Cutting Mexico's rating to BBB, nearing junk status, Fitch said the financial woes of state oil company Pemex were taking a toll on the nation's prospects.

Fitch said mounting trade tensions influenced its view, according to a statement issued shortly after the end of a meeting in the White House in which Mexican officials tried to stave off tariffs U.S. President Donald Trump has vowed to impose next week.

Following a surge in mostly Central American migrants arriving at the U.S. border, Trump threatened blanket tariffs on Mexican imports if it did not do more to stem the flow.

"Growth continues to underperform, and downside risks are magnified by threats by U.S. President Trump," Fitch said.

Mexican President Andres Manuel Lopez Obrador took office in December with ambitious plans to build a $8 billion refinery, a decision ratings agencies and investors warned would divert funds from its more profitable production and exploration business.

"Further evidence that medium-term growth is in decline, whether as a result of policies that actively undermine growth or because of continued policy unpredictability, would put downward pressure," Moody's said in a statement.

Mexico's finance ministry declined to comment.

Lopez Obrador has said the ratings agencies were punishing Mexico for the "neo-liberal" policies of previous administrations.

A Reuters analysis of Pemex accounts from the past decade shows debt increased by 75% during the term of Lopez Obrador's predecessor, Enrique Pena Nieto, amid a landmark energy reform.