DeMatha Coach Bill McGregor, shown here after an Oct. 2010 victory at Good Counsel, is leaving the Hyattsville school after 39 years. (Jonathan Newton/THE WASHINGTON POST)

Bill McGregor’s wife wanted him to continue coaching football at DeMatha High. So did his three grown daughters. While trying to plan his future, McGregor had not slept a full night in weeks. After all, he had worked at the Hyattsville Catholic school since he was 22 years old, when, just months out of college, he was hired to teach English, coach junior varsity football and baseball and drive a school bus.

Nearly 40 years and 278 victories later, after he had long since established DeMatha’s reputation as one of the top varsity programs in the country, McGregor stood before his players in the school’s old gymnasium on Monday afternoon and announced his resignation in a team meeting that took less than 10 minutes.

“It was very difficult, this is my whole identity,” said McGregor, who turned 62 earlier this month. “I have great passion for DeMatha. I love DeMatha. I loved what I was doing and couldn’t think of a better life. I’m at a point if you’re going to do something else and explore more opportunities, now is the time to do it. In a couple years, I might be too old.”

McGregor’s departure is effective the end of this school year. He declined to say what he plans to do next, although one of his options is to work in a football-related business in Baltimore for Gilman School football Coach Biff Poggi. McGregor said he had not thought about whether he would coach again.

His wife, Brenda, said the decision came in part from the belief that there were no more challenges remaining for him at DeMatha.

The news was met with a mixture of surprise, anger and disappointment by DeMatha’s players, though they insisted that business as usual will carry on for their team.

“People are still going to be recruited from here and this is still going to be a powerhouse program,” junior defensive end Michael Moore said.

While McGregor weighed his options over the past three weeks — at one point saying he was “99.9 percent sure” he would return to DeMatha — school principal Daniel McMahon formed a committee to determine a new coach if it was necessary. McMahon said on Monday that he expects a new coach could be hired in less than a month. Possible candidates include DeMatha assistant coaches Elijah Brooks and Deno Campbell, former assistants Tim Breslin and Dennis Golden and McNamara Coach Bryce Bevill, a former DeMatha player and assistant coach.

Whoever is hired will take over a program accustomed to winning. McGregor’s teams captured 17 Washington Catholic league titles, including six in a row from 2003 to 2008, and finished No. 1 in The Post’s rankings seven times. His career mark of 278-40-3 makes him the fourth-winningest coach in Maryland high school football. McGregor, who won four Catholic league titles in six seasons as the DeMatha baseball coach, also was known for helping more than 350 former players earn college football scholarships.

“He will certainly be missed, no question about it,” said Good Counsel football Coach Bob Milloy, the state’s all-time victory leader with 353 “He’s a classy guy, a very good coach and quite an adversary, I can tell you that.”

Even as he planned to leave DeMatha, McGregor declined to settle ongoing debates such as the best player or team he coached. His favorite memory might be from 1982, when the a Hail Mary pass from Eric Chapman to Joe Connolly beat Gonzaga for the Stags’ first league title since 1967. Other highlights included a 1990 victory over Brockton, Mass., and a 1994 victory over Chambersburg, Pa.

McGregor was the All-Met Coach of the Year in 2003 and was honored before Super Bowl XXXIX in 2005 as the NFL’s National High School Coach of the Year.

“There were so many classic games over the course of time in the [Washington Catholic Athletic Conference], some of the Carroll games we had were just fantastic,” McGregor said. As for players, “you would have [to compare] somebody like a 5-[foot]-6 offensive guard to a 6-7 tackle. So many different players that have done so much.”