MEXICO CITY —One of President Enrique Pena Nieto’s closest advisers and confidants, Finance Secretary Luis Videgaray, has resigned in a move seen as linked to the unpopular decision to invite Republican presidential candidate Donald Trump to visit Mexico.

Pena Nieto has taken responsibility for inviting Trump, but a former government official familiar with the workings of the administration said Videgaray would have played a preponderant role in the decision. Newspaper columnists in Mexico have reported Videgaray was behind last week’s visit, after which Pena Nieto was criticized for not being forceful enough in rejecting Trump’s proposals and comments about Mexico.

Videgaray “was the architect” of Trump’s visit, because he was the adviser that Pena Nieto had “the most reliance on, and was closest to,” said columnist and political analyst Raymundo Riva Palacio.

Videgaray acted as Pena Nieto’s campaign manager during his 2012 election campaign and has been seen as the architect of many administration policies. He led Mexico’s Treasury Department and is sometimes referred to as treasury secretary or minister.