As recently as 2012, the International Civil Aviation Organization, an arm of the United Nations that serves as the umbrella organization for airline regulation, raised the lack of systemic screening for psychological problems as a weakness that needed to be addressed, particularly with regard to younger pilots. The Montreal-based group’s 2012 Manual of Civil Aviation Medicine cited “an apparent mismatch” between the likelihood that mental rather than physical problems would afflict young pilots, “and the tools being used to detect them (the traditional medical examination).”

The pervasive culture of privacy in Germany created a bias against delving into Mr. Lubitz’s condition and effectively blinded the country’s airline regulator to the medical problems afflicting German pilots.

The German Federal Aviation Office, which issues pilot’s licenses, relies entirely on the country’s nearly 500 licensed flight doctors to determine pilots’ fitness to fly. But an audit last year by the European Aviation Safety Agency found that Germany’s strict data-protection rules have meant that the information that flight doctors submit to the regulator is not sufficiently detailed to allow officials to validate the doctors’ findings.

The European Commission called on Germany in November to fix this among a dozen other oversight failures identified by the aviation safety agency. Berlin responded last year with a series of proposed remedies, which the authorities in Brussels continue to review. A ruling from the commission is expected in the coming months.

Other nations have taken stricter measures than Germany has when it comes to dealing with depression and other mental illnesses among flight crews.

Dr. Richard Soderberg, chief medical officer at the civil aviation and maritime department of the Swedish Transport Agency, said that while depression would not permanently disqualify a pilot in Sweden, the pilot would be grounded during treatment. The agency would then require the pilot to turn over all medical records pertaining to the depression and submit to psychiatric evaluation every six weeks or so, and the pilot would not be allowed to fly alone.

“The privacy of the pilot cannot be traded for aviation safety,” Dr. Soderberg said.

Security measures put into place after the Sept. 11 attacks, intended to guard against threats coming from outside the cockpit, failed to anticipate a threat from within it.

Image A Nantucket police officer reported debris after the crash of an EgyptAir plane in 1999. Credit... Stephen Rose/The Boston Globe

Lufthansa, like other European airlines, had installed the armored cockpit doors insisted on by the United States following 9/11, after they were mandated by regulators worldwide. But European regulators did not follow the United States in additionally requiring that two crew members be in the cockpit at all times.

The point of the policy was not to guard against a rogue pilot but to ensure that someone was available to reopen the locked door for a returning crew member while the remaining pilot was at the controls. European airlines instead permitted a lone pilot in the cockpit, but installed cameras allowing that pilot to check on the identity of anyone at the door, and to decide while seated whether to override keypad entry from the outside.

It was only after the Germanwings crash that Europe reversed course and recommended having two crew members in the cockpit at all times.

A Known Risk

Though the highest-profile example of the pilot-suicide problem, Mr. Lubitz was far from an isolated case. In recent years, a series of commercial pilots appear to have crashed their aircraft intentionally or been stopped by fellow crew members as they tried. In most cases, those pilots had been screened for psychological problems.

“There was almost a denial by the industry, and in particular among pilots, that we don’t do things like that,” said Robert Scott, a former British Navy pilot and aviation consultant in Vancouver, British Columbia, who also heads a branch of the Canadian Mental Health Association. “It’s not part of our culture. It’s beyond the pale.”

“Now we have so much evidence that we have grudgingly come to accept that, yes, it is a problem,” he added.

Over the past two decades, other episodes were played down or hushed up, and in any case did not lead to any major changes in the regulation of the psychological fitness of pilots.

Image Indonesian military officers guarded the debris of the SilkAir jet in 1997. Credit... Supri/Reuters

In 1997, a SilkAir Boeing 737 crashed in Indonesia, killing all 104 people aboard. The pilot had recently been demoted in the wake of a complaint about his behavior and what one United States government report termed “cowboy practices.” Investigators later learned he was also under financial and family strains. United States investigators concluded that he had committed suicide. But Indonesian investigators ruled out that explanation.

Two years later, an EgyptAir Boeing 767 departing New York crashed into the Atlantic off Nantucket Island and killed 217 people. The United States National Transportation Safety Board concluded that the co-pilot purposely put the jetliner into a steep dive after uttering repeatedly, “I rely on God.” Under pressure from Egyptian officials, American investigators did not deem the crash a suicide, but ruled out mechanical failures and blamed the co-pilot’s actions at the controls.

That same year, an Air Botswana pilot who had been grounded for medical reasons took off without authorization in one of the airline’s turboprops and threatened to crash into his carrier’s two other passenger planes that were parked on the ground.

Passengers waiting to board one of the planes were quickly moved to safety. United States officials documented that the pilot followed through on his threat and slammed into the planes, engulfing them in flames and dying in the crash.

The lack of any substantive evidence of what happened to Malaysia Airlines Flight 370 last year has led investigators to consider the possibility that the plane might be another example of one of the pilots’ deliberately downing the aircraft.

Beyond those cases, there have also been numerous close calls.

On Aug. 20, 2010, court records show, a pilot on a Spirit Airlines flight out of Port-au-Prince, Haiti, took the passenger jet he was flying out of autopilot and accelerated the airplane nearly to maximum speed, pulling the plane up into a rapid climb.

He had exhibited erratic behavior before, notably in February 2010, when he was found lying on the floor of the cockpit on a flight from San Juan, P.R. He failed to tell the airline or his medical examiner that he was self-medicating with St. John’s wort, an herbal supplement often used for psychological issues.

Image The wreckage of a Mozambique Airlines jet. Credit... NAMPA, Olavi Haikera

In March 2012, a JetBlue flight to Las Vegas was diverted after the captain began talking incoherently about religion, 9/11 and Iraq, and said, “We need to take a leap of faith.”

An off-duty JetBlue pilot on board the flight teamed up with the co-pilot to lock the captain out of the cockpit. Passengers helped subdue the troubled pilot, who was trying to re-enter the cockpit. He was later found not guilty of criminal charges by reason of insanity.

There is a common theme of denial in many cases of pilot suicide, as the responses of the Egyptians and the Indonesians demonstrate. After a Royal Air Maroc captain crashed an ATR-42 turboprop in 1994, killing all 44 aboard, Moroccan investigators concluded that he had committed suicide, according to a United States summary of the case, but his pilot’s union disputed the finding.

“We can no longer feel 100 percent confident in the person sitting beside us in the cockpit,” said Mr. Scott, the aviation consultant and pilot. “That is an awful feeling.”

The transportation safety board has cited several of these cases as reasons for improving flight data recorders, including making it harder for pilots to disable recorders and improving ways for the devices to survive crashes and be recovered even when aircraft crash in deep water.

Screening out pilots who are determined to keep flying and are willing to lie will be difficult, experts said. “At the moment I don’t see tests if somebody doesn’t want to talk about his problems and he’s hiding all his symptoms,” Mr. Kemmler, the former Lufthansa official, said. “We don’t have a psychological flight recorder.”

But flight doctors are well aware of the risks.

“It remains astonishing how many pilots with mild or fading depressive disorders taking antidepressants flew without the knowledge of flight doctors — and still fly for us,” Dr. Uwe Stüben and Dr. Jürgen Kriebel, who both worked for Lufthansa, wrote in the abstract of a paper published in 2011, while Mr. Lubitz was still a trainee.