YJ Fischer served at the State Department from 2012 to 2016 in various roles, including Advisor in the Bureau of Near Eastern Affairs, Senior Advisor and Chief of Staff in the Office of the Counselor, and Assistant Coordinator for Iran Nuclear Implementation. She was a drafter of the foreign policy portion of the 2016 Democratic Party platform. Follow her at @yjfischer. The views expressed in this commentary are her own.

(CNN) If President Donald Trump wants to get serious about slowing migration across our southern border, he should reunite separated immigrant children with their parents and focus on addressing the factors causing families to flee Central America. No wall or detention camp will deter migrants from trying to make it to America if they fear that death awaits them back home. And many currently believe that to be the case.

Instead of resorting to cruelty at the border, the Trump administration should tackle migration at the source. Improving our relationship with Mexico, working with local leaders to address gang violence in Guatemala, Honduras and El Salvador, and restoring America's diplomatic capabilities would do more to stem migrant flows than the administration's misguided zero tolerance policy.

Unlike in previous decades, when most undocumented immigrants came from Mexico , today nearly 50% of those crossing the southern border are coming from Guatemala, Honduras and El Salvador, an area in Central America known as the northern triangle. The region is plagued by drug-related gang violence, with a murder rate that rivals active war zones.

It also has the most violence against women of any region in the world. The violence is so severe that many experts believe most people coming from the northern triangle should qualify as refugees deserving asylum under US and international law.

The Trump administration has responded by trying to prosecute every undocumented person who crosses the border, forcibly separating children from parents, and trying to keep asylum-eligible migrants from stepping on US soil to deny them the ability to file a claim.

While it's too soon to evaluate empirical data from Trump's zero-tolerance policy, anecdotal evidence from migrants -- along with analysis of other tough immigration policies in the past -- suggests that harsh border practices don't deter people, especially when they're fleeing violence.

That's why a better approach would be addressing the situation in Central America so more families felt secure enough to stay. The Obama administration understood this and pushed Congress to allocate $1.4 billion dollars over two years for a range of measures designed to improve security, prosperity and governance in the northern triangle. For instance, in addition to training the police and military, this funding sought to strengthen trade and transportation, professionalize the civil service, and improve fiscal accountability. The Obama team also worked closely with Mexico to strengthen its own southern border, where many migrants cross long before they get near the United States.

Instead of building on this progress, Trump has alienated Mexico, proposed massive cuts to aid for the northern triangle and hollowed out the US Foreign Service, making it harder to implement a coherent Central American strategy.

Here are three steps the Trump administration should take to correct its mistakes and get back on the right track in Central America.

To start, Trump should take advantage of the recent presidential elections in Mexico and improve our strained relationship with our southern neighbors. Left-wing populist Andrés Manuel López Obrador (also known as AMLO) won a sweeping victory in Mexico's presidential elections last week. And his party also won a majority of governorships and an absolute majority in both chambers of Mexico's Congress. As a result, AMLO comes into office with a strong mandate to enact major policy reforms. So far, he's said very little about how he plans to handle migration flows from Central America. AMLO could become an effective partner on border security if he wants to be helpful, or he could prove a major thorn in the side for the United States. Trump needs to make this relationship a priority.

Second, the Trump administration should work with leaders and civil society in Central America to pursue an aggressive campaign against corruption. Reforming the security services is particularly crucial. Many fearful citizens in the northern triangle distrust the police and military as much as they do the gangs and drug-runners. Improving security enough to slow outward migration will take more than putting more boots on the ground and guns in the streets. That's already led to accusations of excessive force, extrajudicial killings and human rights abuses.

Instead, the Trump administration should focus on improving the integrity of the judiciary. The attorneys general in all three countries will be replaced by the end of the year and efforts are already underway to weaken these offices, especially in Guatemala where the President is being investigated. Strong attorneys general are essential for tackling corruption, and the Trump administration should help bolster these prosecutors with adequate funding and support.

Independent magistrates are similarly critical, which is why the administration should press the northern triangle countries to implement procedures for selecting independent and qualified judges. In places like El Salvador , where four out of five judges on the Constitutional Chamber of the Supreme Court will finish their term this month, transparent and standardized selection procedures could significantly shape the court.

Follow CNN Opinion Join us on Twitter and Facebook

Third, we need a new "surge" of personnel to strengthen America's efforts, but they should be foreign service officers who can work with other governments -- not border patrol officers trying to arrest children and families. At the State Department, I worked for Ambassador Tom Shannon, one of America's most senior foreign service officers who served administrations of both parties for decades. Ambassador Shannon was a top Latin America expert who used his deep experience to lead our outreach in the region.

Unfortunately, according to McClatchy, under Trump, 60% of our top-ranking career diplomats have left government, including Ambassador Shannon and our ambassadors to Mexico and Panama. This is a crippling problem. The Trump administration should do everything it can to restore the Foreign Service and empower our diplomats.

Trump may like the idea of looking tough at our border, but a smarter strategy begins farther south. Pursuing policies that allow migrants to live safely at home is the more compassionate and responsible course.