Two years ago, Mark O'Connor, a senior manager in the city's personnel department, cooperated with an investigation by the city inspector general that led to the ouster of his boss, former Human Resources Director Tanya Smith.

His participation in that case eventually led to the loss of O'Connor's own job, along with actions taken against him because he is gay, according to a federal lawsuit.

The complaint, filed Tuesday in U.S. District Court for the Eastern District of Pennsylvania, alleges that Smith's successor, current Human Resources Director Albert D'Attilio, forced O'Connor into early and unplanned retirement after denying him a promotion and repeatedly making antagonizing comments about his sexual orientation. The complaint names the city and D'Attilio as defendants.

D'Attilio did not respond to phone or e-mail messages. City Solicitor Shelley Smith declined to comment on the lawsuit, as did O'Connor's attorney, Arthur Bugay.

O'Connor, hired by the city in 1987, had worked since 1999 as a hiring-services manager, designing civil-service tests for firefighters, police, corrections officers, and sheriff's officers. He also oversaw preemployment psychological and physical-fitness tests for uniformed city personnel.

"At no time prior to June 2008" - when Mayor Nutter appointed D'Attilio to replace Smith - "did the fact that Plaintiff is a gay man or that he exhibited mannerisms that are not gender-typical ever become an issue in his professional relationships with other city personnel," the complaint says.

Yet that, according to the suit, is when O'Connor's problems began.

D'Attilio told O'Connor that "people can tell" he is gay because he "waved his hands around," the suit says. The complaint says D'Attilio suggested that uniformed city officials, with whom O'Connor frequently worked, "needed someone they could trust," and it wasn't him.

D'Attilio's alleged actions distressed O'Connor, creating a hostile work environment and making it tough for him to do his job and come to work, according to the complaint.

Additionally, the suit says that in December 2008, D'Attilio promoted someone less qualified to the job of deputy director for uniformed testing. That person, Michael McAnally, had been involved in Smith's illegal manipulation of an oral citywide test for management trainees, according to the suit. Smith's improper actions led to her dismissal about six months earlier.

The complaint states that D'Attilio denied O'Connor the promotion because he is gay and because he was helpful in the investigation of Smith.

O'Connor, who is 54, later applied for and received leave under the Family Medical Leave Act. He left the city payroll March 6.