The United States homeland security secretary on Tuesday signed a deal to address migration in Central America during a visit to Costa Rica.

The country is one of the main transit routes for migrants making their way north in the hope of reaching the US, and the American government has tried to deter people without documents from reaching its southern border with Mexico.

According to the Costa Rican government, the agreement seeks to boost the fight against migrant smuggling and human trafficking, while exploring options to "strengthen current programs for the integration of migrants, asylum seekers and refugees."

Alejandro Mayorkas, the US homeland security secretary, hailed the "historic" agreement -- the first of its kind in the region -- and spoke of opportunities it would bring to people "to achieve their dreams."

"We selected Costa Rica as the first partner and friend to sign such an important agreement because of its leadership in the matters that impact the region and, quite frankly, the world," he said after meeting President Carlos Alvarado.

"This agreement speaks of possibilities. As the president of Costa Rica has addressed and as our president of the United States has addressed, it is all about possibilities and possibilities become realities when we invest."

Alejandro Mayorkas (R), the US homeland security secretary, hailed the 'historic' agreement
Alejandro Mayorkas (R), the US homeland security secretary, hailed the 'historic' agreement Costa Rican presidency via AFP / Handout

Mayorkas arrived in Costa Rica's capital San Jose after visiting Mexico, where he met with President Andres Manuel Lopez Obrador.

The Mexican authorities said there was a need to invest in Central America and generate greater opportunities that prevent migration.

In recent years, the flow of undocumented migrants has increased, while Washington has tightened its immigration policies.

Since taking office in January 2021, US President Joe Biden has pledged a more humane immigration policy and sought to dismantle a controversial Trump-era border program that denies asylum seekers entry to the United States while their case is reviewed.

Officially called the Migrant Protection Protocols, then-president Donald Trump's "Remain in Mexico" program saw tens of thousands of non-Mexican asylum seekers -- mostly from Central America -- sent back over the border pending the outcome of their applications.

According to the United Nations, last year almost a million Mexicans and Central Americans fled their countries due to violence, lack of opportunities, climate change the Covid-19 pandemic.