A former University of California, San Francisco psychiatrist pleaded guilty Wednesday to possession of child pornography.

Billy Lockhart, 38, was a resident for UCSF’s department of psychiatry when he was arrested in May 2017 at his home on the 100 block of Buena Vista Terrace, police said.

A search warrant was served and investigators found more than 600 videos and pictures of child pornography on various devices belonging to Lockhart.

The graduate of Yale University’s school of medicine was arrested along with his boyfriend Benjamin Martin, 33, at the home they shared. Investigators also found hundreds of files of child pornography on Martin’s devices, police said.

The San Francisco Police Department’s Internet Crimes Against Children Unit started looking into Lockhart in March 2017 after investigators found he was uploading and trading child pornography online — at times using UCSF Wi-Fi, officials said.

A statement issued by UCSF said the university placed Lockhart, who it said was involved with adult patients only, on leave when he was arrested, suspended him from clinical activity and eventually terminated him.

On Nov. 30, 2017, a federal grand jury indictment was handed down charging Lockhart and Martin with one count of possession of child pornography, said Abraham Simmons, a spokesperson for the U.S. Attorney’s office in San Francisco.

Lockhart’s attorney asked that her client remain out of custody until sentencing because he is changing careers and taking a coding class. She added that he was in therapy and part of a community of recovering addicts. Two supporters sat in the courtroom gallery during Wednesday’s brief hearing.

Martin has not pleaded guilty, according to information available to Simmons Wednesday afternoon. Lockhart’s court sentencing is scheduled for Nov. 7 at 10 a.m.

Erin Stone is a San Francisco Chronicle staff writer. Email: erin.stone@sfchronicle.com Twitter: @erstone7