The investigation into the crash of Germanwings Flight 9525 has turned toward the co-pilot, whom a French prosecutor says locked the captain cockpit before deliberately flying the plane into the ground and killing all 150 people aboard.

That revelation, which came today, casts Tuesday's crash in a chilling light but would explain why an Airbus A320—an industry workhorse with an excellent safety record—with an experienced crew went down in picture-perfect conditions without raising an alert.

The captain, whom authorities have not identified, left the cockpit soon after the airplane reached cruising altitude for what was to be a two-hour flight from Barcelona to Dusseldorf. The captain could not get back into the cockpit. A military official told The New York Times the cockpit voice recorder, recovered from the crash site Tuesday, reveals “the guy outside is knocking lightly on the door, and there is no answer. You can hear he is trying to smash the door down.”

You might think that the captain, of all people, would have unfettered access to the cockpit. But the cockpit door appears to have worked exactly as it was designed. Since November 1, 2003, any aircraft carrying more than 60 people or certified with a maximum takeoff weight of 50 tons or more flying in European Union airspace must have an "approved flight crew compartment door that is designed to resist penetration by small arms fire and grenade shrapnel, and to resist forcible intrusions by unauthorized persons."

The rule, which mirrors FAA regulations, was implemented after 9/11 to protect pilots in the event of a hijacking. "The purpose of the door is to keep out unwanted intruders," says Douglas Moss, who flew A320s for 16 years before switching to a Boeing 777 about a year ago. But if the French prosecutor is correct, Germanwings Flight 9525 is a rare instance in which this rule worked against the safety of the aircraft and those aboard it.

The doors Airbus uses on the A320 is by default programmed to lock. But there is a switch in the cockpit that can be toggled from "norm," "unlock," and "lock." In normal circumstances, crew members entering the cockpit push a single button on a 12-digit key pad. It works much like a doorbell: A chime rings in the cockpit, and the captain or co-pilot presses "unlock" to open the door.

Should the pilots be incapacitated, a fail-safe allows authorized crew to open the door by entering an emergency code in the keypad. That sounds an alarm inside the cockpit; if there is no reply within 20 to 30 seconds, the door unlocks for approximately five seconds.

Here's the thing, though: Anyone in the cockpit can hit the "lock" button and override the emergency code, barring anyone from entering. "You can prevent that door from unlocking," Moss says. "That keypad can only be worked successfully if there's no response from inside the cockpit."

"If the person in the cockpit is deliberately trying to keep people out, there's really no way around that."

Here's an Airbus-produced instructional video explaining how the whole system works: