Inspector General Joe Ferguson uncovered racist and sexist emails circulating in the Department of Water Management while investigating allegations that the son of a former alderman had used his city email account to sell guns, City Hall sources said Monday.

Paul Hansen, a now-fired, $122,280-a-year district superintendent in the Department of Water Management, is the son of former longtime Ald. Bernard Hansen (44th). The elder Hansen presided over Wrigleyville during the Cubs’ marathon battle for lights at Wrigley Field.

On Monday, Paul Hansen refused to comment about the gun or email investigation before hanging up on a Chicago Sun-Times reporter.

His checkered past with the Department of Water Management includes allegations that his political clout helped him get his job back after a DUI conviction.

Sources said it was during the course of an eight-month-long investigation into allegations that Hansen was using city emails to sell guns that Ferguson stumbled upon the hate-filled emails that triggered Friday’s housecleaning in the department at the center of the Hired Truck and city hiring scandals.

Barrett Murphy, head of the Chicago Department of Water Management, was fired last week. | Sun-Times file photo

Mayor Rahm Emanuel fired Water Management Commissioner Barrett Murphy, whose wife is a close friend of the mayor’s wife, Amy Rule, and accepted the resignations of Hansen and the department’s $148,380-a-year managing deputy William Bresnahan.

Sources said Murphy was held responsible for the chain of racist and sexist emails sent by an underling whom the commissioner failed to discipline, even though Murphy was among those receiving the emails.

He could not be reached for comment. The inspector general’s office refused to comment.

Emanuel was tight-lipped when asked Monday to define the role he accused Murphy of playing in the email scandal. But he referred obliquely to the broader investigation of alleged gun sales.

“We were made aware from an IG report on one particular employee. But in that process, it exposed a culture in the Water Department and in the workplace that, in my view, does not represent what the city’s values are,” the mayor said.

Mayor Rahm Emanuel also accepted the resignation of William Bresnahan (shown in 2004). | File photo

“Barrett agreed that there should be a re-set button hit as it related to the culture, which is why I’m pleased that Randy [Conner] is assuming that leadership and the IG work continues at this time.”

Sources said the racist and sexist emails mark an ugly new chapter in a politically incorrect department that has more than its share of them.

They include racist references to now-former President Barack Obama; perverse comments about women and gay people, and someone distributing an image of an African-American deputy commissioner in charge of water distribution that depicted him with a gorilla face.

Murphy’s firing was a stunner because of his close ties to the mayor.

Former Mayor Richard M. Daley hired Murphy in 1999 as Chicago prepared for the potential Y2K terrorism threat that never materialized. Murphy’s wife, Lynn Lockwood, is an Emanuel friend who once chaired a political fundraising committee for the mayor.

Lockwood had a one-year, $160,000 consulting contract with the tourism agency known as Choose Chicago. She was an aide to former first lady Maggie Daley and worked for the city cultural affairs department. Emanuel appointed her to the Chicago Public Library board in March 2012.

On Friday night, hours after being summarily dismissed, Murphy and Lockwood received an award from the Crossroads Foundation of the Francis Xavier Ward School for their work in promoting a Catholic education and in helping to raise money that was used, in part, to provide scholarships for disadvantaged children, many of them minorities. The prestigious Catholic school was started by Maggie Daley.

Sources said Lockwood delivered an acceptance speech through tears. She told associates that her close friend, Emanuel’s wife Amy Rule, was texting her throughout the bittersweet and humiliating Friday night ceremony at a downtown hotel.

The award and the contribution it symbolized for the high-profile couple underscored the surprising nature of the allegations against Murphy.

“These emails are not consistent with who they are. They’re socially conscious people,” said a source who has known Murphy and Lockwood for years.

Yet another source who knows Murphy well was less tolerant, even though the now-former commissioner has not been accused of writing any of the hateful emails — only receiving them.

“If he was trying to fit in with the culture [at the Department of Water Management], shame on him,” the source said.

Ald. Edward Burke (14th), chairman of the City Council’s Finance Committee, said the image of a commissioner who looked the other way when racist and sexist emails were being circulated by underlings does not jibe with the Barrett Murphy he knows.

“My experience with Barrett Murphy has always been terrific. I thought he was a great city official who had a great record of accomplishment in whatever role he filled in the city government. And I wish him well in his future,” Burke said.

Burke was asked whether the new scandal would revive calls to privatize the Department of Water Management that Emanuel put to rest shortly after taking office by doubling water and sewer rates to rebuild the aging system.

“That’s an enterprise fund. It’s heavily dependent on bond proceeds. There’s probably so many restrictions in the bond documents that gets them their funding that to undertake something like that would be a major change in the form of government which might even require a referendum,” the alderman said.

The Department of Water Management has long been notorious around City Hall for its history of corruption and an ugly, hate-filled culture.

In 2005, a housecleaning in the department at the center of the Hired Truck scandal swept out then-Water Management Commissioner Rick Rice and nine politically connected underlings accused of participating in a payroll scam.

The brother-in-law of Cook County Commissioner John Daley and the relative of a key Hired Truck figure were among those purged for allegedly falsifying attendance records over a two-month period — maybe longer — by swiping each other in and out.

First Deputy Water Commissioner Donald Tomczak was convicted of doling out jobs, promotions and overtime to an army of political workers who worked for Daley-backed candidates, including Emanuel. Support from Tomczak’s illegal army helped elect Emanuel to Congress in 2002.

In 2010, Hansen was allowed to return to his then-$97,760-a-year assistant district superintendent’s job after an unpaid leave triggered by a DUI arrest that stripped him of his driver’s license.

A valid driver’s license was essential to his job, which called for supervising water and sewer projects, deploying personnel and equipment and inspecting job sites.

According to the police report, Hansen was driving west on Route 20 in Galena when he was pulled over for speeding. When the officer got behind him, Hansen allegedly kept going and increased his speed to more than 75 mph in a 55 mph zone. He also was observed repeatedly crossing the center line, police said.

After pulling Hansen over, the officer reported, he smelled alcohol on Hansen’s breath and that he had glassy eyes, slurred speech and a “slight stagger” or “sway.”

Asked if he’d been drinking, Hansen acknowledged having “about four or five beers at a bar,” police said. He twice refused a field sobriety test and was placed under arrest. At that point, he asked if “something could be worked out” stating that he knew Terry Kurt, the state’s attorney for Jo Daviess County, the police report states.

At the sheriff’s office, he refused a Breathalyzer test. That refusal carries an automatic 12-month suspension of driving privileges for first-time offenders.

Hansen was charged with speeding and driving under the influence, but pleaded guilty June 9 to a lesser charge of reckless driving. He was fined $1,500 and sentenced to a one-year probation.

Hansen’s unpaid leave had begun after the Chicago Sun-Times raised questions about his arrest and looked into reports from co-workers that the former alderman’s son was having foremen and laborers chauffeur him around and take him to and from work. At that time, Ferguson was trying to determine how Hansen did his job without a license, sources said.