SACRAMENTO (AP) — Federal prosecutors announced charges Friday against two Sacramento County sheriff's deputies accused of illegally selling dozens of weapons, some of which authorities say fell into the hands of criminals.

Deputies Ryan McGowan, 31, and Thomas Lu, 42, both of Elk Grove, face charges of trafficking in handguns that cannot be legally bought by citizens in California, including some exotic weapons such as high-powered rifles mounted on pistol frames.

Also charged were firearms dealer Robert Snellings, 61, of Rancho Murieta and Ulysses Simpson Grant Early IV, 36, of Sacramento, who is accused of buying guns. All four were indicted on Thursday and the charges were unsealed Friday.

U.S. Attorney Benjamin Wagner said the deputies were charged with serving as straw buyers by purchasing the restricted handguns. They then sold the handguns at a profit of thousands of dollars to unqualified buyers through licensed dealers, prosecutors said.

"When law enforcement officers misuse their badges to funnel dangerous weapons to the highest bidder, they compromise the safety of the public," Wagner said at a news conference. "By putting personal profit ahead of public safety, they undermine the very essence of their duty."

Sacramento County District Attorney Jan Scully said three of the weapons sold by McGowan wound up in the hands of criminals. One went to a convicted drug dealer, who also is being charged in the county. The other two weapons were later illegally converted to assault weapons and recovered by Daly City police after a six-hour standoff, Scully said.

"These are just a couple of cases where these illegal guns end up on the streets and in the hands of criminals," Scully said.

McGowan's attorney, William Portanova, said the deputy is innocent.

"Deputy McGowan is a gun collector who has bought and sold guns for years, just like all the other gun collectors, and he has never made a profit. He is not in the business of dealing guns. He's a gun enthusiast," Portanova said.

McGowan and Early did not speak during their afternoon court appearances as their attorneys entered not guilty pleas and requested jury trials on their behalf. McGowan was released on $50,000 bond in the federal case and was expected to post $30,000 in a separate state case. Early was released on an unsecured bond of $25,000. Both were ordered to return to federal court on July 10.

Early's attorney, Donald Kilmer, would not comment outside the courtroom. Other defense attorneys did not return telephone and emailed messages.

California law bars citizens from buying handguns that have not been deemed safe by the state Department of Justice, but the law exempts peace officers. The deputies are accused of using their peace officer exemption to buy dozens of weapons over four years, then selling them to others for a profit.

Investigators said there was no evidence the deputies intended the weapons for criminals. Peace officers who own off-roster firearms may sell them in a private sale, as long as it is brokered by a federal firearms licensee.

They cannot, however, use these private sales to conduct a business with a principal objective of making a profit through the repetitive purchase and resale of firearms.

McGowan and Lu were charged with engaging in a firearms business without a license, which carries a maximum penalty of 10 years in prison and a $250,000 fine.

Snellings was charged with five counts of conspiracy to make false statements in federal firearm records. Early, the buyer, and McGowan were each charged with one felony count of conspiracy to make a false statement in federal firearm records.

The maximum penalty for each conspiracy charge is five years in prison and a $250,000 fine. McGowan faces two separate state counts of selling large capacity magazines to an undercover agent last year; two counts of possessing illegal assault weapons; and one charge of illegal possession of steroids. Those charges could bring him a maximum total sentence of five years and eight months in state prison if he is convicted.

Federal records show since 2008, McGowan purchased 41 handguns and sold 25 on his own. Lu bought 27 since 2008 and resold 23.

Snellings' business, Snellings' Firearms, is accused of selling or transferring 33 guns to McGowan and 29 to Lu between 2008 and late 2011.

Two other police officers, one in Sacramento and the other in nearby Roseville, were implicated in the investigation but were not charged because of their limited involvement. Both have since lost their jobs.

The two deputies worked at the department's Rio Cosumnes Correction Center in Elk Grove. Lu resigned and McGowan is on paid administrative leave, said Deputy Jason Ramos, a spokesman for the sheriff's office.

The U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives, assisted by deputies and police within the local departments, spent months investigating the alleged weapons dealing. The investigation became known when agents served search warrants in November.

The weapons include easily concealable semiautomatic pistols that shoot high-velocity .223 caliber bullets, the same long-range ammunition used by the U.S. military for its M16 and M4 rifles. Also sold were handguns that fire .50 caliber pistol bullets, a less powerful version of the same large-caliber round used in machine guns and sniper rifles. Investigators say semiautomatic handguns built to look like Israeli-made Uzi submachine guns also were bought and sold.

The federal investigation led Assemblyman Roger Dickinson, D-Sacramento, to propose legislation to close what he calls a loophole in the state's "unsafe handguns" law, passed in 2001.

Peace officers and members of the military are required to use a registered firearms dealer if they want to sell their privately owned weapons. But current law does not require the dealer to make sure the ultimate buyer is also eligible to own handguns that aren't on the Department of Justice's list of approved weapons.

Dickinson said his AB2460 would require dealers to check whether weapons are considered "unsafe handguns," and sell them only to other law enforcement officials or members of the military who are exempted under the law. The bill passed the Assembly in May and is awaiting action in the Senate.