Attorney General Jeff Sessions directed federal prosecutors to pursue harsher charges against undocumented immigrants who commit crimes, or repeatedly cross into the U.S. illegally, and he promised to add 125 immigration judges in the next two years to address a backlog of immigration cases.

The moves are part of the administration’s efforts to deter illegal immigration and meant to target gangs and smugglers, though nonviolent migrants could also face more severe prosecutions.

In a memo issued Tuesday, Mr. Sessions instructed prosecutors to make a series of immigration offenses “higher priorities,” including transporting or harboring illegal immigrants, illegally entering or re-entering the country, or assaulting immigration-enforcement agents.

The memo also required prosecutors to consider charging some undocumented immigrants with aggravated identity theft, which carries a mandatory two-year prison term.

In remarks Tuesday to border patrol agents at the U.S.-Mexico border in Nogales, Ariz., Mr. Sessions spoke in stark terms about the threat he said illegal immigration posed.