James F. Kenney bid adieu Thursday to 23 years on City Council with a gracious and emotional speech, in which he thanked colleagues past and present for helping him grow from a callow, cocksure freshman to a respected and passionate legislator.

The address, offered as a goodbye gesture, served to powerfully define his coming mayoral campaign as a vehicle for social change and fairness, two themes that have long marked his work on Council.

"Don't ever be afraid to take an unpopular position just because it is unpopular when you know it is right," he said at one point, recalling his early support of gay rights and the opposition he faced. "Stand up for the underdog. Never let the bullies overcome."

He cast himself as driven to selfless public service, a lesson, he said, learned from his father, a firefighter, and the Jesuits who taught him at St. Joseph's Prep.

"You cannot be truly happy, no matter what you accomplish, no matter what you accumulate, no matter how much bling you acquire," he said, recalling the Jesuit influence, ". . . unless you are serving someone else."

The speech served as a capstone to Kenney's Council career, which began in 1992 when he took office as a 33-year-old at-large member.

Kenney, now 56, resigned officially Thursday to run for mayor in the May 19 Democratic primary. He joins State Sen. Anthony H. Williams, former District Attorney Lynne M. Abraham, and former Common Pleas Court Judge Nelson Diaz. Doug Oliver, former spokesman to Mayor Nutter, and former State Sen. T. Milton Street Sr. are set to enter the race in February.

Kenney's last day on Council started lightheartedly enough, as friends, staffers, and other members offered hugs, pats on the back, and good-natured ribbing before Council met for its weekly session.

It turned more poignant when members were given time to speak once the day's agenda was finished.

One after another, they warmly described Kenney as a pugnacious and demanding colleague with whom they clashed at times but whom they grew to admire and respect as a friend, mentor, and partner in legislation.

Councilman Brian J. O'Neill, a Republican, recalled Kenney's arrival and how green he was. Twenty-three years on, O'Neill said, Kenney has grown.

"He's smart. He is trustworthy. He works hard. He cares about people who are less fortunate," O'Neill said. "Today, he is ready."

With tribute after tribute, Kenney often stared uneasily at his desk, so much so that Councilwoman Blondell Reynolds Brown, a former schoolteacher, barked at him as if he were a distracted student: "I've got to see your eyeballs, Councilman Kenney."

When it was his turn to speak, Kenney was ordered by Council President Darrell L. Clarke to take the president's lectern, high above the chamber. Reluctantly, he did.

From there, he spent much of his time thanking others, including staff and the news media that had covered his career. He then singled out colleagues who over the years helped tame and educate the enfant terrible he once was.

He thanked Councilwoman Jannie L. Blackwell for showing him that "people who are down and out and on the street are human beings who deserved dignity and respect."

He credited former Councilman Angel Ortiz and the late Councilman David Cohen with educating "a white Irish Catholic guy from South Philly who didn't know a thing about gay rights."

Kenney spoke effusively of another former colleague not present, one with whom he had a tempestuous relationship, Mayor Nutter.

He recalled the financial collapse of 2008 and the hard choices Nutter had to make to balance the budget.

"Let's not forget, this city was on the precipice," Kenney said. "This mayor brought it back from the edge, and I think he deserves a round of applause for that."

Before he was finished, Kenney wound back to his father, recalling the acrid smell of burned rubber and wood that accompanied him when he came home from work.

As "terrible" as the odor was, it was reassuring, Kenney said. It meant his father had come home safely.

"As we know, a lot of people did not come home," Kenney said, a reference to police and firefighters who have lost their lives on duty. "We are not running into burning buildings or cutting people out of cars, but let's dedicate ourselves to that attitude of public service and, I think, in the end, we will all have a better city."

The point made, it was time to close things out.

"All my colleagues, I love you, I really do. I just love you. And I'll miss you," he said, pausing briefly to hold back tears. "And I'll get out of here before I do something I shouldn't do."

With that the room rose as one. Whatever else he might have said was lost to the din.