A Maryland court Wednesday upheld disciplinary action against the psychiatrist who leaked details about the sexual habits and mental health of convicted spy Robert Hanssen in 2001.

A three-judge panel of the Maryland Court of Special Appeals upheld lower court rulings against Alen J. Salerian, who had been hired by defense attorneys to evaluate Hanssen, a former FBI agent arrested for giving highly classified information to Russia.

The two met over the course of a week in April 2001, during which Hanssen admitted he had a “long history of sexual betrayal and exploitation” of his wife — a fact that Salerian later shared with Hanssen’s wife.

Court documents said Salerian was warned repeatedly by Hanssen’s attorney, Plato Cacheris, not to disclose any details of his conversations with the former FBI agent. Salerian, along with most others involved in the case, had also signed a letter from the U.S. Attorney General promising not to disclose information about Hanssen due to “national security interests” involved.

In May 2001, within a week after telling Hanssen’s wife about the sexual betrayals, Salerian was fired by Cacheris. Salerian also received a letter from Hanssen forbidding him from discussing their meetings with anyone other than defense attorneys, including family members and “certainly with anyone outside the family.”

But in the following weeks, Salerian was quoted in numerous media outlets discussing Hanssen’s mental state.

In a June 2001 CBS report, Salerian claimed that he had disclosed the information with Hanssen’s permission. Salerian, who believed the FBI, the church and the medical system had failed Hanssen, said it was “a situation where there was life and death involved and I had to make a call as a physician to say what I think is right.”

In a disciplinary hearing against Salerian, Hanssen testified via telephone that he had agreed to let Salerian tell his wife about the sexual exploits because Salerian convinced him that the media were about to publish it.

Hanssen pleaded guilty to espionage in July 2001 and is serving life in federal prison. The 2007 film “Breach” was based on his arrest.

Hanssen’s attorneys and wife filed a complaint against Salerian in September 2001 with the Maryland State Board of Physicians, charging he disclosed confidential information. That same month, Salerian’s license to practice medicine in Maryland expired.

He applied for reinstatement of his license in September 2002, only to be told the board was charging him with immoral and unprofessional conduct and violating attorney-client and physician-patient privilege. He attempted to withdraw his application in July 2003, but was told he could not do so while charges were pending.

An administrative law judge initially recommended that Salerian be fined $20,000, have his license revoked and be barred from applying for reinstatement for up to three years.

In January 2005, the board decided instead that Salerian be fined $5,000 and be placed on probation for two years, which would not end until he completed an ethics course.

Salerian challenged the action, but it was upheld by the Montgomery County Circuit Court. He raised 10 issues in his appeal to the Maryland Court of Special Appeals, which rejected all 10 Wednesday.

Messages left on his voicemail Wednesday at the Washington Center for Psychiatry were not returned. A woman who answered the phone at