The net flow of Mexicans into the US has dwindled to a trickle and may now be in reverse, giving the lie to right-wing warnings of an "invasion" of illegal immigrants and bringing to an end four decades of inward migration.

A survey from the Pew Hispanic Center finds that the largest wave of immigration in American history to have taken place from a single country has now been brought to a virtual standstill. In the five years from 2005 to 2010, about 1.4m Mexicans immigrated to the US – exactly the same number of Mexican immigrants and their US-born children who quit America and moved back or were deported to Mexico.

By contrast, in the previous five years to 2000 some 3m Mexicans came to the US and fewer than 700,000 left it.

The latest figures signify the end of an era. From 1970, the Mexican-born population of the US has risen steeply, reaching a peak of more than 12m in 2010.

Now it is falling, with the decline including undocumented Mexican immigrants living in the US who now number about 6.1m – 58% of the total unauthorised immigrant population of the country.

In an election year in which immigration policy has provided a sharp divide between the presidential candidates, evidence that illegal Mexican immigration has dried out is of immeasurable significance. Mitt Romney, the presumptive Republican nominee, has backed hardline anti-illegal immigration clampdowns introduced by states around the country, promising to make them federal policy should he win the presidency.

President Obama, on the other hand, has said he supports the "Dream Act" that would provide a path to citizenship to law abiding Hispanic college students, though he has failed to put that into effect. He has also stepped up deportations of Mexicans who have infringed the law, with about 300,000 illegal immigrants deported back to Mexico in 2010 alone.

The new statistics take the wind out of the sails of those who have targeted illegal Mexican immigrants for taking jobs away from unemployed Americans – the Pew study suggests that the flow of immigrants has decreased largely because under the economic downturn incoming Mexican immigrants can no longer find work.

"As the US economy continues to struggle, people no longer want to come here to work," said Ali Noorani, head of the non-partisan group National Immigration Forum.

The Pew study also points to a dramatic reduction in the number of Mexicans apprehended as they try to cross the border. More than 1m were picked up by US immigration officers in 2005 – now that number has plummeted by more than 70% to 286,000 last year.

Whit Ayres, a Republican political strategist, said the evidence of a large decline in illegal border traffic was helpful. "Before you can move forward with any serious immigration reform you need to give Americans confidence that the border is secure," he said.

While the poor state of the economy explains much of the dip in numbers, so too does the rash of harsh anti-illegal immigration laws introduced in several states including Arizona, Alabama, Georgia and South Carolina. The new statistics suggest that the tough laws - that attempt to make life so uncomfortable for undocumented immigrants that they leave the country, a policy known as "attrition through enforcement" - are to some extent working.

On Wednesday the US supreme court will hear oral presentations on SB 1070, Arizona's landmark immigration bill from 2010, that has spawned a spate of copy-cat legislation in other states. The court will have to decide whether key provisions in the law, including a clause that would force local police officers to check the immigrant status of anyone they come across whom they suspect of being undocumented, should be allowed to go ahead or barred because they undermine federal control of immigration policy.

Noorani said that the Pew figures underlined the urgency of finding a solution to America's immigration conundrum. "When the US economy bounces back we will need a supply of immigrant labour and at that point we are going to need a functioning immigration system – which is something that at the moment we sorely lack."