The Department of Homeland Security is a tale of the good, the bad and the ugly.

It has 230,000 employees, about the population of Birmingham, Ala. Almost all of them are good, hardworking public servants, providing valuable service to the country.

But in the past few weeks, a handful of those workers have disgraced the agency. Last month, Secret Service agents were implicated in an ugly Colombian scandal involving prostitutes. Last week, current and former transportation security officers in Los Angeles were named as bad guys and arrested on drug trafficking and bribery charges for allegedly allowing dope couriers to pass through airport security.

While it’s true those folks are a tiny fraction of the entire DHS staff, it’s also true that the department’s problems go beyond a few bad actors and reach to issues that are organizational and endemic.

A report by the Partnership for Public Service released Thursday says that DHS ranked at the bottom of large agencies on leadership. In March, a House subcommittee held a hearing with a telling title: “Building One DHS: Why Is Employee Morale Low?” And that was before the recent troubles.

“DHS employees strongly believe in their work and mission,” Rep. Michael McCaul (R-Tex.), chairman of the Homeland Security subcommittee on oversight, investigations and management, said in a statement about the hearing he chaired. “But what does it say when only 37 percent of DHS employees believe senior leaders motivate them and only 37 percent are satisfied with their senior leaders’ policies and practices?

“Those numbers are some of the poor grades assigned to the department’s leadership in the Office of Personnel Management’s Federal Viewpoints Survey,” he continued.

“This is unacceptable.”

The subcommittee plans another hearing on DHS problems later this month.

On the good side of the ledger are numerous points outlined by the DHS media office:

●The Border Patrol is better staffed than ever. Seizures of contraband are up, and apprehensions — a key indicator of illegal immigration — have decreased 53 percent in three years and now are less than 20 percent of the peak.

●DHS has trained more than 213,000 local, state and federal law enforcement officers under the Nationwide Suspicious Activity Reporting Initiative.

●In 2011, transportation security officers screened more than 600 million passengers at 450 airports and found more than 125,000 prohibited items. More than 1,300 were firearms.

●Customs and Border Patrol officers arrested 8,195 people wanted for crimes, including homicide, rape, assault and robbery, in fiscal 2011 and denied entry to more than 215,600 people.

“Over the past three years, DHS has transformed how we protect our nation from the most serious threats of the 21st century,” DHS spokesman Peter Boogaard said. “We have improved our nation’s domestic capabilities to detect and prevent terrorist attacks against our people, our communities and our critical infrastructure.”

Although the department scores low on leadership, its top leadership maintains important congressional support.

“I talk regularly with Secretary [Janet] Napolitano about these issues, and have confidence that she is committed to improving the Department as an organization, as is the Committee,” Peter T. King (R-N.Y.), chairman of the House Homeland Security Committee, said in an e-mailed statement.

DHS opened its doors in March 2003 in attempt to correct bureaucratic national-security problems identified after the Sept. 11, 2001, terrorist attacks. The new department combined almost two dozen agencies. The Bush administration called the reorganization “the most significant transformation of the U.S. government in over a half-century by largely transforming and realigning the current confusing patchwork of government activities into a single department whose primary mission is to protect our homeland.”

Said King: “We cannot forget that the Department is still a relatively new combination of 22 different agencies.”

Yet, the defense is getting old.

“At some point, we can’t rely on that excuse anymore,” said John Palguta, a vice president of the Partnership for Public Service. (The Partnership has a content-sharing relationship with The Washington Post). After nine years, “you should be able to affect a culture change, even in a large organization,” he added.

Sen. Joseph I. Lieberman (I-Conn.), who was instrumental in the formation of the department, acknowledges that it “has its share of problems.” But Lieberman, chairman of the Senate’s Homeland Security and Governmental Affairs Committee, added that “we cannot lose sight of the fact that DHS is now indispensable to the nation’s safety and security.”

“In the overall scheme of things,” he said, “the Department has performed admirable and essential work.”

If only it could do that work without so many ugly issues.

Previous columns by Joe Davidson are available at Follow the Federal Diary on Twitter: @JoeDavidsonWP