Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Long before Donald Trump started accusing Mexico of sending criminals, rapists and drug dealers into the U.S., Mexico had a plan in the works to filter out undesirables crossing south from the U.S.

Late Wednesday, Mexico began requiring pedestrians going from San Diego to Tijuana at the San Ysidro, California crossing, to separate in one of two lines: one for Mexicans and one for foreigners. Foreigners must show a passport, fill out a form and - if staying more than a week - pay 322 pesos, or roughly $20 for a six-month permit, The Associated Press reported.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

The changes have been in the works for years, but were implemented as Trump leads the GOP presidential candidate field, a campaign he began with the incendiary remarks about Mexicans and Mexican immigrants.

"This is about putting our house in order," said Rodulfo Figueroa, Mexico's top immigration official in Baja California state, which includes Tijuana.

Travelers have long followed similar protocol at Mexican airports, but the new border procedure marks a big change at land crossings that weren't designed to question everyone. Pedestrians and motorists have generally entered Mexico unencumbered along the 1,954-mile border with the United States.

For Mexico, it is a step toward closing an escape route for American criminals who disappear in Mexico. Border inspectors will tap into international criminal databases. Motorists will see no change, and if lines get too long, officials will also wave pedestrians through.

More than 120 Americans expelled from Mexico this year while living in Baja California had arrest warrants in the U.S., according to Figueroa, delegate of the National Migration Institute. Some ordered to leave last year were on the FBI's most-wanted list.

Mexican authorities also said the new procedure could help in identifying Americans in Mexico, such as the many more who were stranded in Cabo San Lucas during a recent hurricane, more than U.S. authorities knew were there.

Follow NBC News Latino on Facebook and Twitter