SACRAMENTO, Calif. — A Republican state legislator who previously sought the right to carry a loaded weapon inside the state Capitol was cited Wednesday for trying to bring a loaded handgun onto a flight.

California Assemblyman Tim Donnelly was detained after a Colt .45 with four rounds was discovered inside his carry-on bag as he passed through a screening machine at Ontario International Airport, said Transportation Security Administration spokesman Nico Melendez.

Another magazine with five rounds was in Donnelly's carry-on bag, Melendez said.

Donnelly, who lives in the Southern California mountain community of Twin Peaks, is an outspoken advocate for gun rights and represents a largely working class district east of Los Angeles in a region referred to as the Inland Empire.

In a statement, he said he inadvertently left the weapon in his bag.

"When I arrived at the security check point, X-ray machines revealed that I had forgotten to remove a gun from my carry-on luggage," he said in the statement from his office.

Donnelly, 45, said he boarded the next Southwest flight without incident. He declined to answer questions from reporters after arriving at the Capitol in Sacramento for the first day of this year's legislative session.

Melendez said TSA officials referred the incident to airport police, who cited Donnelly for possession of an unloaded firearm and released him from custody.

Police Sgt. Belinda Nettles said the officer who cited Donnelly made a mistake and that the citation will be corrected to reflect that the firearm was loaded.

Federal regulations allow passengers to carry guns in their checked luggage under certain conditions. About 1,200 people each year are cited for having a firearm in their carry-on luggage, according to the TSA.

"You can take a weapon on a trip with you as checked luggage, as long as it's unloaded and declared to the airline and in a sealed carrying case," Melendez said.