“We have been trying to send a message,” said J. Thomas Manger, president of the Major Cities Chiefs Association, which represents police departments across the country. “The bad guys have a real fear of federal prosecutions versus state prosecutions.”

Penalties for federal gun convictions are steep. On average, firearms defendants spend six years in federal prison. If they are convicted under the two statutes requiring mandatory minimum sentences, that average jumps to 11 years.

In the three months following a directive from Mr. Sessions last year to pursue gun crimes, possession cases — a relatively routine charge — rose nearly a quarter. That was part of a 15 percent increase in all federal gun prosecutions in the first nine months of 2017.

Three out of every four federal gun charges filed in the 12 months starting in October 2016 were under a statute forbidding felons from owning or transporting a gun, according to Syracuse University’s TRAC database, which monitors gun crime statistics. The period encompasses both the end of the Obama administration and the first several months of Mr. Sessions’s term.

Three law enforcement officials described a newfound interest among prosecutors in taking on smaller gun cases — referred to in law enforcement parlance as one-man, one-gun cases for their narrow impact. Such cases had long been left to state and local prosecutors, freeing Justice Department officials to focus on broader investigations of interstate gun trafficking and criminal networks.

On Jan. 1, 2017, police in York, Pa., stopped Steven Gray, 46, whom they said was carrying a pistol. Mr. Gray was charged in federal court last April with illegally possessing the firearm, which he denied was his. A forensic investigation by the Bureau of Alcohol, Tobacco, Firearms and Explosives found no discernible DNA on the weapon. Mr. Gray, who had a prior felony drug charge, was convicted and faces up to 10 years in prison when he is sentenced in the coming months.

“Sometimes it appears they’re just looking for numbers,” his lawyer, Thomas Thornton, said of federal prosecutors, who denied the accusation.