Boston Police Commissioner Edward F. Davis today thanked Mayor Thomas M. Menino for the opportunity to lead the department, declaring that as he leaves, the department is better than when he arrived from Lowell nearly seven years ago.

“It is time to go,” Davis said today, his voice trembling slightly, during a news conference at police headquarters.

“I feel very positive about leaving on my timeline,’’ he said. “I leave the department on my own accord. I wanted to clear the deck for the new administration.’’

Advertisement - Continue Reading Below

Davis also defended his record on diversity in the department, which has come under criticism from some within the department and in the community. Some mayoral candidates have faulted Davis for what they see as an insufficient effort to diversify the police department.

“The controversy has had no effect on me leaving in no way, shape or form,’’ Davis said. “I’m proud of my record.’’

Davis is leaving later this year for a fellowship at Harvard University’s Institute of Politics, where he will teach and take courses. He said he has several job opportunities he is mulling but won’t make a quick decision on where he will next be employed.

“I’m not leaving Boston,’’ said Davis, who owns a home in Hyde Park. “I’m going to be around.’’

Davis also lauded his wife, Jane, for her patience and support during his entire law enforcement career, but especially during his time in Boston when the telephone would often ring at 3 a.m. or 4 a.m. He also said his three children, who have endured their father’s career as a high-profile public servant, have welcomed his stepping away from the media spotlight.

“They are very excited that I’m leaving,’’ he said. “Actually, they are a little relieved.’’

Suffolk District Attorney Daniel F. Conley, Davis’s key partner in the law enforcement community, stopped by headquarters, praised Davis’s tenure and expressed sadness that his leadership of the department is coming to an end.

“I’m personally disappointed he’s leaving,’’ said Conley, a candidate for mayor in tomorrow’s election. “I was looking forward to working with him for years to come.’’

In a statement today, Mayor Thomas M. Menino thanked Davis for his “leadership and tireless commitment to improve the quality of life for the people of Boston.”

Menino said that Davis has “has served the people of Boston with integrity, a steady hand, and compassion. Under the Commissioner’s watch, serious and violent crime in the City of Boston has decreased substantially. His focus on community policing has empowered our residents and increased community trust, positioning our officers as residents’ allies in making our neighborhoods safer. During some of our City’s most trying days, Commissioner Davis worked relentlessly to protect the safety of all our citizens.”

There had been speculation that Davis would seek a more high-profile job following the Boston Marathon bombings, after his calm and reassuring response garnered him national praise. He also oversaw a 30 percent decrease in violent crime during his tenure as commissioner, though at times there were spikes in the numbers of murders and shootings.

In recent weeks, Davis had been mentioned among several potential candidates to lead the federal Department of Homeland Security. No one has yet been picked for that position.

Davis’s spokeswoman, Cheryl Fiandaca, said Davis handed his resignation letter to Menino on Saturday.

Since Menino announced he would not seek reelection in March, department and community leaders had speculated on whether Davis would leave with the mayor, who will step down on Jan. 6.