David Gergen has been a White House adviser to four presidents and is a senior political analyst at CNN. A graduate of Harvard Law School, he is a professor of public service and director of the Center for Public Leadership at the Harvard Kennedy School. James Piltch is Gergen's chief research assistant. His writing on civic life and education has appeared in The Washington Post, The Boston Globe, and The Chronicle of Higher Education. The opinions expressed in this commentary belong to the authors. View more opinion on CNN.

(CNN) Even by President Donald Trump's standards, his current efforts to whip up hatred of immigrants seem extraordinarily brazen. As a group of about 3,500 migrants (already diminishing in size) trudge slowly up through Mexico toward the American border, Trump is going all out to turn them into a key to election victory next Tuesday. What other president can you imagine:

— Falsely proclaiming that these migrants are "invaders" who pose a serious threat to the United States?

— Sending over 5,000 troops to the border to protect the border (that's over one troop per migrant)?

— Ordering the troops to arrive just before the midterms, even though the migrants are a few weeks away

— And now promising an effort to end birthright citizenship for babies born in the United States?

Such actions are alarming, especially in the wake of the anti-Semitic shooting in Pittsburgh.

David Gergen

James Piltch

Perhaps after the midterms, when emotions calm, the President and his team, along with cooler heads from both sides of the aisle on Capitol Hill, will sit down and explore solutions that might actually work. If they do, they would discover from recent history in Mexico a different path forward on immigration -- one that is both more humane and more effective.

Although Trump has been drumming up fears with claims of an immigration crisis today, the time of large-scale undocumented migration to the United States took place during the 1990s and early 2000s. There were roughly 3,500,000 undocumented immigrants in the United States in 1990, according the Center for Migration Studies. That number increased more than 100% to 8,600,000 by 2000, and then by about 36% to 11,725,000 in 2010.

Mexican immigrants made up the largest share of undocumented immigrants to the United States during this time. Between 1990 and 2010, the number of undocumented immigrants from Mexico residing in the United States increased from just over 2 million to roughly 6.6 million.

Recent years, however, have seen an important change in immigration from Mexico. Since 2010, the flow of undocumented Mexican immigrants has decreased significantly. "The number of US undocumented residents from Mexico fell by almost one million between 2010 and 2016," according to the CMS study. Not surprisingly, given these numbers, the total population of undocumented immigrants living in the United States in 2016 was its lowest since 2003.

These changes took place under former President Barack Obama, long before Trump's child separation policy and threats to close and send troops to the border. Why did fewer Mexican immigrants come to America? Not because of fences or walls. Instead, numbers declined because life improved in Mexico while opportunities here grew sparser.

Although Mexico still struggles with significant crime and corruption, its economy is considerably stronger. The employment rate has improved, as unemployment has dropped now to just 3.6%. Wage growth is also strong , and according to purchasing power parity -- one key economic measure -- the Mexican economy is the 12th largest in the world, just behind France.

Now the incoming President of Mexico, Andrés Manuel Lopéz Obrador, has said he will focus on fighting corruption. If his efforts are successful, AMLO, as he is known, could fix the long-term problems that still hold Mexico back from reaching its full potential.

This economic improvement and hope for political change have likely contributed to something more meaningful with regard to immigration: citizen satisfaction. The UN ranked Mexico as the 24th happiest country on earth in 2018, as it surpassed Chile, Brazil and Argentina from the year before and moved to just six spots behind the United States (which saw its happiness ratings drop significantly).

Meanwhile, Andrés Villarreal, a researcher at University of Maryland, found in 2014 that the Great Recession in the United States made fewer Mexican citizens want to come to the United States. The reason? Decreases in labor demand, particularly in industrial sectors like construction, hit young men with low education especially hard.

The net effect of all these economic and political changes here and in Mexico is that, by the most recent measure available, Mexicans report wanting to leave their country at the same rates Americans want to leave the United States. And the Mexican citizens who do leave are not coming here: Pew found that more people of Mexican heritage left the United States between 2009 and 2014 than immigrated here.

This recent history brings us back to the thousands of desperate men, women and children now making their way toward the US border after beginning their trip in Honduras and crossing into Guatemala and Mexico. CNN has reported the story of a mother who "sold everything" for a chance to come to the United States. Recent migrants like this woman, who are willing to give up their homes and risk their lives, largely come from Honduras, Guatemala and El Salvador. What do these nations have in common? Their economies are in tatters, and their citizens are in horrific danger almost every day.

Follow CNN Opinion Join us on Twitter and Facebook

If the United States truly wants to stem the long-term tide of immigration, then we should focus on doing what we can to create better and safer opportunities for the citizens of these countries. We should not cut aid; we should increase it. We cannot turn our backs on Central America's Northern Triangle. Rather, we should seize upon the proposal from AMLO to form a three-way partnership among the United States, Mexico and Canada that collectively invests more into Central America, bringing greater stability and inclusive growth to the region.

The lessons of Mexican growth and immigration suggest that the American values of humanity and opportunity truly are the best tools for creating an effective immigration policy.