Montgomery County Heath Officer Travis Gayles resigned Wednesday, marking an abrupt end to the tenure of one of the area’s highest-profile public health officials as coronavirus ­cases have risen in the Maryland suburb and are surging elsewhere in the country.

Over the course of the pandemic, Gayles advocated for stringent measures to curtail the spread of covid-19, pushed for health equity in vaccine distribution and led a rollout that has resulted in one of the highest vaccination rates in the country. He earned accolades for his positions — including being featured this year on CBS’s “60 Minutes” — but also criticism from some who felt he was too cautious, especially when it came to his advice on schools.

“We’re really going to miss him,” Montgomery County Executive Marc Elrich (D) said in a news conference Wednesday. “I thought he was an extraordinary leader.”

Elrich said he learned about Gayles’s resignation in an email Gayles sent early Wednesday from vacation in France. In the email, which was obtained by The Washington Post, the health officer said he intends to leave Sept. 12.

Gayles did not cite a reason for his departure but said he had enjoyed serving residents in the Maryland suburb for four years, including during the past 18 months of the pandemic. He thanked residents “for creating a space for science to be heard and embraced.”

Gayles did not respond to questions from The Post on Wednesday.

More than 70 percent of Montgomery’s 1 million residents have been fully vaccinated, according to a tracker by The Post. Montgomery, a majority-minority jurisdiction, is one of the wealthiest counties in the country, but also has pockets of poverty.

The average number of new daily coronavirus infections has increased from a low of six in June to 112 on Wednesday, though virus-related hospitalizations have remained low.

A pediatrician by training, Gayles served as D.C. chief medical officer before moving to Montgomery in 2017. He has been a vocal champion for health equity, pioneering an “equity framework” for the county when vaccinations became available that gave priority to vulnerable communities.

“His work has saved lives,” County Council Vice President Gabe Albornoz (D-At Large) said of Gayles. “There is no question about that.”

Elrich said Gayles faced a variety of challenges over the past 18 months, including repeatedly clashing with Gov. Larry Hogan (R), particularly about reopening private schools, and absorbing “a torrent of hate and vitriol” from the public. “He has pretty much gone through hell over the last 18 months,” Elrich said.

Gayles, who is Black, spoke publicly about the stream of racist and homophobic attacks he received on social media and in communications to his office. He revealed last year that he was in touch with police about the attacks, and deactivated his public Twitter account in recent months to avoid the hateful comments.

Elrich said he had not yet talked to Gayles about why he decided to leave, but he said he knows how hard the pandemic has been on health officials across the country. Public health workers nationwide who have quit or resigned during the pandemic have cited burnout from months of working overtime or frustration with public pushback on coronavirus restrictions.

“[Gayles] is critiqued in a way that not even the county executive is in some ways. And race is a part of that,” Earl Stoddard, who is White, said in an interview earlier this year while he was head of emergency management. “I’ve noticed his credentials being questioned in a way that mine haven’t, even though his credentials when it comes to public health are more impressive than mine.”

County Council member Evan Glass (D-At Large), the first openly gay member of the body, said the “incredible hatred” that Gayles faced “takes a toll on a person.”

Gayles’s cautious approach to reopening frustrated some — especially parents of children in the county’s private schools and in its public school system, which was slower than many to bring students back to the classroom last school year. (Its first major return of students did not come until mid-March.)

“As a parent in the county, I am relieved,” Jennifer Linton Reesman, a psychologist and mother of an 11-year-old in Montgomery’s public schools, said of Gayles’s departure.

She said she was frustrated by Gayles’s continued advice to keep schools closed, even when studies showed the risk of coronavirus transmission in classrooms was low when masks and distancing were employed. She said she understood the desire to shut down schools when information was scarce, but that there should have been “a realignment” as officials learned more.

“Instead,” she said, “there was a digging in of the heels.”

Margery Smelkinson, an infectious-disease scientist who has four children in Montgomery public schools, described Gayles’s approach as “very excessively overly cautious.”

Even once students were allowed to come back to the classroom, she said, the phase-in was slow. Her fourth-grader, for example, had just 22 days of in-person instruction last year. “It didn’t have to be like that,” Smelkinson said.

She said that she hopes that the next health officer is willing to look at all of the data and be “more reasonable” than Gayles.

Albornoz said it is vital that Elrich appoint a new health officer “as soon as humanly possible.” With concerns about the rise of the delta variant nationally, especially its impact on children, he said, it is clear the county is “not out of the woods.”

Gayles is the second high-ranking official to depart from county government this summer, following assistant chief administrative officer Caroline Sturgis, who resigned in July to become budget director for the city of Port St. Lucie, Fla. Stoddard was nominated last month to succeed her.

Donna St. George contributed to this report.