The president of the University of Southern California officially stepped down Tuesday in the wake of the explosive sexual assault scandal involving the school’s longtime gynecologist — and allegations that officials ignored decades of complaints.

C. L. Max Nikias agreed to relinquish his position “effectively immediately” but will become president emeritus and a life trustee of the school.

In May, Nikias, who had been president since 2010, announced his plans to step down after a mountain of allegations emerged against Dr. George Tyndall, who worked as a gynecologist at the school for 30 years.

Tyndall, 71, who retired last year, is accused in some two dozen lawsuits of making crude comments, taking inappropriate photos and forcing victims to strip naked in order to grope them under the guise of medical treatment.

He has denied any wrongdoing.

Complaints had been lodged as early as 1990 but were not fully investigated until 2016, California’s state Department of Education said.

Nikias’ tenure has also been marred by a Los Angeles Times report about how USC medical school dean Dr. Carmen Puliafito partied with criminals and was caught on video smoking methamphetamine. Puliafito gave up his post in 2016 but remained a faculty member until USC fired him last year.

An online petition calling for Nikias’ ouster had been signed by more than 4,200 people.

Trustees at the university hope to find a successor to Nikias within four to six months, according to a letter sent to staff, students and alumni from board of trustees chair Rick Caruso.

Board member Wanda Austin, who holds an engineering degree from USC and was president and CEO of her own company, The Aerospace Corp., will serve as interim president.

“She is a professional of impeccable integrity and character,” Caruso wrote.

He said she is also “a strong advocate for science, technology, engineering, and math (STEM) disciplines as well as for minorities and women.”

With Post wires