PANAMA CITY (Reuters) -Panama’s new president, Jose Raul Mulino, took office on Monday vowing to curb illegal immigration, with his government quickly signing an agreement with the United States to crack down on migration through the treacherous Darien Gap jungle passage.

In his first address as president, Mulino, 65, promised to seek international assistance to find solutions to what he described a costly “humanitarian and environmental crisis.”

Last year, a record 520,000 migrants risked life and limb, often at the hands of people smugglers, to traverse the Darien Gap, a dense jungle on Panama’s border with Colombia.

“We cannot continue financing the economic and social costs that massive illegal immigration generates for the country, along with the consequent connection of international criminal organizations,” Mulino said.

Minutes later, Mulino’s new foreign minister signed a memorandum of understanding with the U.S. government to “allow the closing off of the passing of illegal immigrants through the Darien,” Panama’s government said in a statement.

In the agreement, signed by U.S. Homeland Security Secretary Alejandro Mayorkas, who attended Mulino’s inauguration, the United States agreed to “cover” the costs of repatriating migrants who enter Panama illegally.

The agreement was “designed to jointly reduce the number of migrants being cruelly smuggled through the Darien, usually en route to the United States,” a spokeswoman for the White House National Security Council said in a statement.

The United States will “support” efforts to repatriate migrants in Panama illegally but did not give further details.

Mulino was elected in May after taking over the candidacy of his running mate Ricardo Martinelli, a popular former president who was barred from running himself due to a money laundering conviction.

Mulino, who was Martinelli’s security minister from 2010-2014 and also served as foreign minister in the 1990s, vowed on Monday to boost job and economic growth while addressing Panama’s swollen public debt.

“We have the challenge of leaving a growing Panama so that those who come after us can do a better job than our generation,” Mulino said.

“The state of public finances is worrying,” he added. “In five years they (the previous administration) doubled the debt (but) with my government team we will turn the economy around and will start progressing.”

(Reporting by Elida Moreno; Additional reporting by Diego Ore in Mexico City and Kanishka Singh and Andrea Shalal in Washington; Writing by Brendan O’Boyle; Editing by Anthony Esposito and Christopher Cushing)