State Education Commissioner MaryEllen Elia surprised school officials on Monday by announcing that she’s stepping down after four years at the helm.

Elia said she plans to join a national education-advocacy firm, but declined to provide further details.

Her last day will be Aug. 31.

Elia announced her resignation at the monthly Board of Regents meeting, shocking its members and other attendees.

Her tenure has not been without conflict, including grappling with Gov. Andrew Cuomo’s controversial plan to use students’ standardized test results to evaluate teachers — a move that was opposed by the teachers union.

Responding to criticism, the state Legislature and Cuomo this past session approved a law that killed that project.

Elia faced a growing movement to eliminate or lessen certain testing requirements for grades 3 through 8.

She grappled with yeshivas and other private schools, prodding them to comply with state regulations to provide an adequate education for basic courses such as science.

“The thing I am most proud of is working to calm the waters here and move the agenda for education forward,” Elia said.