Updated

The federal government announced Tuesday that pilots will not be allowed to have guns in the cockpits of commercial U.S. airplanes.

The announcement came at a Senate Commerce Committee hearing by John Magaw, undersecretary for transportation security. It followed months of debate over whether arming pilots would be a deterrent to hijackers.

Government officials, airline executives and pilots groups had hotly debated the topic in the months following the Sept. 11 attacks. Some airlines had said they would allow their pilots to carry weapons, while other carriers opposed the plan.

Both Transportation Secretary Norman Y. Mineta and Homeland Security Director Tom Ridge previously indicated their opposition to arming pilots.

Magaw announced the decision in response to a question from Arizona Sen. John McCain, the top Republican on the committee. Magaw said a formal announcement will be made later in the week.

Flight attendants, meanwhile, have advocated non-lethal weapons, such as stun guns, that they could use in emergencies.

Sen. Ernest Hollings, D-S.C., who chairs the Commerce Committee, said guns would not be needed as long as pilots kept cockpit doors locked while in flight. "You can put the rule in right now and cut out all the argument about pistols and stun guns," Hollings said.

Opponents of arming pilots have said reinforced cockpit doors now required on all planes mean that pistols are unnecessary. They have also expressed concern that an errant shot might hit a passenger or damage

A campaign by airline pilots to carry guns in cockpits had gained the support of several congressional Republicans, despite the opposition of some Bush administration officials.

House aviation subcommittee chairman John Mica of Florida said last month he and House Transportation and Infrastructure Committee chairman Don Young of Alaska would introduce legislation to allow trained pilots to carry guns.

"Some of us feel pretty strongly on the issue of allowing pilots and crews that are at risk to defend themselves," Mica said. "We don't know what the next attack might look like."

An airline security law passed last fall allows the government to decide whether pilots should carry guns.

Two top administration officials, Transportation Secretary Norman Y. Mineta and Homeland Security Director Tom Ridge, both opposed arming pilots. Mineta had said newly reinforced cockpit doors prevent terrorists from commandeering airplanes.

Airline pilots have pushed for the right to carry arms since shortly after the Sept. 11 terrorist attacks. Officials of five pilots' unions sent a letter to President Bush asking him to arm pilots who volunteer to carry the guns and go through background checks and training.

American Airlines Capt. Denis Breslin had argued other post-Sept. 11 security actions -- reinforcing cockpit doors, inspecting all bags for explosives, improving passenger screening at checkpoints -- don't go far enough.

If those procedures don't foil a hijacking, military fighters acting on the orders of two Air Force generals can order a plane shot down, the Pentagon has said.

Fox News' James Rosen and the Associated Press contributed to this report.