The presidential candidates sparred in Wednesday's debate over Donald Trump's plan to build a wall between the U.S. and Mexico. Trump accused Hillary Clinton of favoring "open borders" and not having a plan to stop migrants and drug smugglers from illegally crossing into the country, while at the same time accusing her of voting for building a border wall when she was senator.

Clinton countered by pointing out that when Trump met in private with Mexico's president in August, he didn't bring up his plan to build wall and make Mexico pay for it.

"Trump went to Mexico and didn't raise it," Clinton said. "He choked," she said.

If elected, Trump said, he will improve trade relations with Mexico, but didn't explain why he didn't discuss the wall during his visit with Mexican President Enrique Pena Nieto.

"I had a very good meeting with the president of Mexico," Trump said.

Clinton's immigration stance

Trump then accused Clinton of being for a wall before she was against it, voting to tighten border security in 2006 when a broad immigration reform bill was up for a vote.

"I voted for border security, there are some limited places where that was appropriate," Clinton said, adding that her "plan of course includes border security."

In fact, Clinton's immigration reform plan on her website doesn't mention adding additional border security for stopping illegal migration or stopping smuggling. Her immigration platform is focused on expanding ways for people already in the country to pay a penalty and apply for legal status and work permits."I don't want to rip families apart. I don't want to be sending parents away from children," she said.

About that wall

Trump's call to make Mexico pay for a border wall often receives the loudest applause at his campaign rallies.

Logistically, building a wall across the entire southwest border would be tough.

The border between the U.S. and Mexico is nearly 2,000 miles, with a fence that spans about 650 miles, according to the Government Accountability Office. Natural barriers such as the Colorado River and Rio Grande River also make it difficult for any wall to be constructed. In addition, hundreds of acres along the border belong to sovereign Native American tribes such as Tohono O'odham Nation. To construct a wall in those sections would require appropriations and waivers from Congress.

The logistics

While there's no official government estimate for how much it would cost to build a wall, Trump has estimated $4 billion to $12 billion for a wall 1,000 miles long, made of precast concrete slabs, rising 35 to 40 feet.Trump's prediction is well below outside cost estimates. A New York Times report cited experts who put the cost of constructing a wall at $26 billion.On his campaign website, Trump says cash will be raised by threatening to stop remittances, the estimated $20 billion sent each year to families in Mexico from relatives living in the U.S. Trump says he'll use this threat as leverage to force Mexico to pay for the wall.

Mexico says not so fast

"I will make Mexico pay for that wall. Mark my words," Trump said when he announced his candidacy last year.Not so fast, say Mexico officials. Pena Nieto has insisted repeatedly that the country would not pay for such a wall, and he and Trump tangled over how extensively they discussed the wall in a private meeting in Mexico City in August.

Trump's prime reason for the wall, he says, is to keep illegal immigrants from crossing into the U.S.A recent study by the Pew Research Center showed that the number of unauthorized immigrants in the country has held steady over the last seven years. Illegal immigration from Mexico has declined by about half a million people since 2009, while increases from Asia and Central America have occurred.