Robert C. Bonner, commissioner of U.S. Customs and Border Protection, will resign after four years of leading an agency that has undergone a rocky transition as a key component of the new Department of Homeland Security.

In a letter to President Bush, Bonner expressed his intention to step down but said he would remain on the job long enough to ensure an orderly transition.

Bush nominated Bonner, 63, a former U.S. attorney in Los Angeles and onetime head of the Drug Enforcement Administration, to be commissioner of the U.S. Customs Service in 2001. In March 2003, Bush nominated him to lead Customs and Border Protection after customs enforcement was absorbed by the new department.

The agency was created in response to the Sept. 11, 2001, attacks, as was the department as a whole. Inspectors from very different agencies -- the Customs Service, the Immigration and Naturalization Service, and the Agriculture Department -- were merged into a single bureaucracy in 2003 with the goal of presenting "one face at the border" to better deter terrorist threats.

With 42,000 employees, CBP, which includes the Border Patrol, inspects goods, people and vehicles at 317 ports of entry and pursues people who try to cross the border illegally. Homeland Security Secretary Michael Chertoff rejected this year a proposal to merge the CBP with Immigration and Customs Enforcement, another agency that handles border security.

In a statement, Chertoff said yesterday that Bonner's "guidance and efforts have been instrumental in balancing our need to preserve the integrity of our borders without sacrificing the free flow of commerce on which our nation and the global community depends."

Bonner's departure could leave the department without permanent leaders in three key posts. The heads of the Federal Emergency Management Agency, and of Immigration and Customs Enforcement are serving in acting capacities.

In his letter to Bush, Bonner said that "this part of the homeland security reorganization has created a border agency that is more effective in preventing terrorists and terrorist weapons from getting into our country."

Not everyone agrees. Charles Showalter, president of the American Federation of Government Employees' National Homeland Security Council, said the consolidation of specialists from various agencies has caused "huge" problems.

A recent report by the nonprofit Migration Policy Institute said that the transfer of customs into DHS has produced mixed results.

The group, which conducted more than 80 interviews during field visits to border communities last year, found that staffing had increased along the nation's borders and the use of technology had improved. There was greater professionalism, and policies were clearer concerning firearms, the use of force and personal searches of suspects, the report said.

But the group also unearthed concerns that CBP inspectors were becoming generalists with overly broad duties, noting a lack of immigration expertise in the agency. The report cited a culture of fear inside the agency, with employees discouraged from talking to outsiders and even from offering ideas. "People who had expertise felt it was not being valued and that input was not being asked for," said Deborah W. Meyers, a senior policy analyst at the institute.

That culture came from the top, said Colleen M. Kelley, president of the National Treasury Employees Union, which represents the former customs inspectors in the agency. "Employees would say it's not in very good shape," Kelley said of the agency. Bonner "had a lot of preconceived notions that did not change over time. They've been difficult times, and I think the employees felt an awful lot of things were dictated, and often not with full information, because he was so far removed from the front line and what was really happening."

Robert Bonner to help transition.