By Aubrey Whelan, Claudia Vargas and Robert Moran

Police Commissioner Charles H. Ramsey will retire at year's end, he said Wednesday morning at a City Hall news conference.

The news comes three weeks before the election to decide Philadelphia's next mayor, who will have the task of finding a successor to lead the 6,500-officer department.

Ramsey, who is 65, came to Philadelphia in 2008 after being chosen for the job by Mayor Nutter. Ramsey said his 47-year career "has been a good ride." His last day will be Jan. 7.

"A leader's only as good as the people we work for," Ramsey said, and "we have an outstanding group of individuals in our department."

The commissioner had been retired from his previous job as chief of the police force in the District of Columbia from 1998 to 2006. He began his career with the Chicago Police Department, where he rose to the rank of deputy superintendent.

President Obama picked Ramsey to cochair the President's Task Force on 21st Century Policing to improve police-community relations.

The mayor thanked Ramsey "for an incredible level of service." He said he had never heard of Ramsey until a friend mentioned his name. Nutter met Ramsey at Union Station in Washington, and picked him from seven or eight other candidates to lead the police department.

"Philadelphia is, was, and will be very, very lucky to have benefitted from the talent of Commissioner Charles Ramsey," Nutter said, who visibly choked up when expressing his gratitude. "Thank you for making my city a safer city."

Under Ramsey's command, Philadelphia has experienced a general decline in reported crimes, although homicides have ticked up recently. The 246 murders reported in 2013 were the lowest since 1967.

Police-involved shootings spiked under his watch, and he invited a Department of Justice study that recommended wholesale changes in procedures and training.

Ramsey's plan included community engagement, more responsibilities for district captains and data-informed policing, Nutter said.

Since December, Ramsey has been dogged by demonstrators who have been protesting the December 2014 fatal police shooting of Brandon Tate-Brown at a car stop in Mayfair.

As commissioner, Ramsey makes about $260,000 annually. Nutter awarded him a $60,000 raise in 2011 to prevent Ramsey from returning to Chicago to run his hometown police department.

Ramsey's job security became the a subject of debate during the Democratic mayoral primary earlier this year. Former Councilman Jim Kenney, who won the election, said he would keep the police commissioner should he choose to stay.

However, Kenney has been -- and continues to be -- a frequent critic of the Stop & Frisk policy implemented under Ramsey. Kenney said he would do away with police officers' practice of patting down people suspected of carrying weapons.

Nutter pushed Stop & Frisk while campaigning for mayor in 2007, advocating for a more aggressive use of the practice in high-crime areas, to target the possession of illegal handguns.

A Kenney spokeswoman declined to comment on Ramsey's announcement, saying Wednesday was a day to honor the commissioner's service.

Ramsey said he thought a new mayor ought to have an opportunity to pick his or her own commissioner.

"I'm not tired. I'm not burnt out. I'm actually in my prime," he said. But he said it was time to move to another level -- "a national one," perhaps.

He said that he's had discussions with Drexel's president about teaching a class, and he mentioned work in private industry. But first, he said, he's going to go on vacation in January with his wife of 30 years, whose strength and patience he thanked.

(c)2015 The Philadelphia Inquirer