SAO PAULO -- Brazil's new president blasted the United Nations' migration pact on Wednesday indicating that Latin America's largest nation will adopt a hard line on immigration.

President Jair Bolsonaro, who has promised to pull out of the UN deal, said on Twitter that he wants to ensure immigrants coming to Brazil not only abide by the laws, but also sing the national anthem and respect the country's culture.

"Immigration cannot become an indiscriminate act. It is imperative for us to establish proper criteria for each country," said Bolsonaro, a fan of U.S. President Donald Trump who took office Jan. 1. "If we control those who enter our homes, why should it be different with Brazil as a nation?"

The UN pact signed by 164 countries in December recommends ruling out mass deportation policies and deems the deterrence of immigrants should be only a last resort.

Bolsonaro said he won't reject help for those crossing the border, an apparent reference to Venezuelans fleeing an economic and political crisis at home. In recent years, tens of thousands of Venezuelans have crossed into neighbouring Brazil.

Brazil has also welcomed Syrian and Lebanese refugees in recent years, along with Haitians, Bolivians, Paraguayans and Peruvians seeking better economic opportunities.

Bolsonaro said Brazil and migrants both will be safer if the country adopts its own rules.

Brazil's outgoing government signed the UN pact weeks before Bolsonaro took office. As soon as the deal was signed in Morocco, the then president-elect said his administration would discard it.

Brazilian media reported several embassies received communication to inform them Bolsonaro's decision to leave the pact. Brazil's foreign ministry did not reply to requests for comment on Wednesday.

Maristela Basso, a law professor at Sao Paulo University, said that despite the heated rhetoric, the move wouldn't likely be adopted quickly. She said a formal withdrawal would need to be approved by Congress, where Bolsonaro's party controls about 10 per cent of seats in the lower house and has 4 of 81 seats in the Senate. Congress doesn't convene until February.

"The president cannot leave the pact just with his pen," said Basso.

Former Foreign Minister Aloysio Nunes, who represented Brazil in the pact negotiations, recently said on Twitter that the pact does not "authorize indiscriminate migration" and "seeks to serve as reference for the organization of migration influxes."

Camila Asano, a co-ordinator at human rights non-profit Conectas, said the move not only affects immigrants to the South American nation, but could also impact more than 3 million Brazilians.

"Nowadays there are more Brazilians living abroad than foreigners living in Brazil, Asano said. "This move undermines one of Brazil's main international credentials; we are a country of immigrants and our migration policies were seen as a reference."