Donald Trump clarified his position on immigration in a speech Wednesday night, after weeks of public confusion about where he stands on the issue that has defined his campaign.

The Republican presidential nominee softened the tone of his campaign-trail promise to deport all 11 million immigrants believed to be living in the country illegally. He explained that while all undocumented immigrants would be subject to deportation under his plan, removing those who had committed crimes would be his administration's priority if he were elected.

"In a Trump administration, all illegal-immigration laws will be enforced. As with any law enforcement activity, we will set priorities," Trump said, adding, "Anyone who entered the United States illegally is subject to deportation."

What this policy would mean in practice — how many immigrants would be forced to leave and how quickly — is unclear. A recent analysis by the financial research firm Moody's explores the possible economic consequences depending on how aggressively Trump enforces his plan.

If Trump forced millions of undocumented immigrants to leave the country, according to the analysis, many Americans would be put out of work. It's counterintuitive: Trump's supporters argue that forcing undocumented workers out of the country would create more jobs for native workers. Yet Mark Zandi, the chief economist at Moody's Analytics, pointed out that the relationship between undocumented and legal workers can be more complicated.

Zandi, who has advised Sen. John McCain (R-Ariz.) and other politicians in both parties, explains that deporting undocumented immigrants would increase costs for employers, because they would have to compete for the workers remaining in the United States, causing wages to rise. Already, the labor force has been shrinking as older workers retire, and the unemployment rate is under 5 percent, which suggests relatively few workers are looking for jobs.

To compensate, businesses would have to increase prices. Some firms would lose customers and could be forced out of business.

"Asking these folks to leave is going to put a hole in the economy that’s going to cost jobs," Zandi said. "It’s going to cost the jobs of American citizens."

Some opponents of immigration argue that, even if foreign labor benefits the economy overall, some workers — especially those with less skill or education — may be harmed financially.

"Most illegal immigrants are lower-skilled workers with less education who compete directly against vulnerable American workers," Trump said Wednesday. "They're hurting a lot of our people that cannot get jobs."

Some economists, notably George Borjas of Harvard University, agree with this view, but they constitute a minority. After extensive research, most economists say immigration has a minimal effect on wages for this group of workers.

Meanwhile, the increase in prices would leave consumers with less to spend on other products, potentially reducing employment in those industries as well. Undocumented immigrants are also consumers, and the businesses they patronize would lose customers as they left the country.

In a scenario in which a Trump administration forced all of the country's undocumented immigrants to leave in eight years, Moody's calculated that the unemployment rate would increase to 5.7 percent in the first year of his presidency. By 2021, prices would be 4.1 percent above what they would be otherwise.

A decade from now, gross domestic product would be reduced by 4.6 percent. Average personal income would be about $42,000 year, compared with about $44,000 without the mass exodus.

According to an estimate by The Washington Post, the categories of undocumented immigrants Trump identified as priorities for removal include somewhere between 5 million and 6.5 million people. In a scenario considered by Moody's in which 6 million undocumented immigrants depart, prices would be 2.8 percent higher after five years, and after a decade, the reduction in GDP would be about 2.9 percent. Personal income would be about $43,000, according to this projection.

Even if only 3.7 million people left the country, the changes in the labor market would still be profound, Moody's calculated. Prices would be 1.4 percent higher in five years and GDP would be 1.7 percent smaller after a decade.

"There is only one core issue in the immigration debate, and that issue is the well-being of the American people," Trump said Wednesday, explaining that the goal of immigration reform should be to "make life better for American citizens." The analysis from Moody's warns that Trump policies could prove counterproductive.

For Zandi and his colleagues, Arizona is a cautionary example. They studied what happened as the state cracked down on undocumented labor beginning in 2008, when all employers were required to verify the legal statuses of their workers.

The researchers calculated that, as of last year, the state's output was about 0.8 percent less than it would be without the restrictions.

"It’s one of the reasons the financial crisis was so hard on Arizona," Zandi said.

In his speech Wednesday, Trump did not explicitly call for requiring employers to vet their employees, saying only that the electronic verification system should "be used to the fullest extent possible under existing law."

"We will work with Congress to strengthen and expand its use across the country," he said.