Postmaster General and chief executive Patrick Donahoe, left, announced he will retire Feb. 1, 2015. The Board of Postal Governors named Megan Brennan, right, the current chief operating officer of the Postal Service, as the new postmaster general. (Alex Wong/Getty Images)

Postmaster General and U.S. Postal Service chief executive Patrick R. Donahoe announced Friday that he will retire Feb. 1 after a four-year run overseeing dramatic restructuring and cost-cutting as Americans turned from sending letters to communicating via the Internet.

He will be succeeded by Megan J. Brennan, 52, the agency’s chief operating officer and executive vice president, who will become the first female postmaster general, the board of governors announced.

Donahoe’s retirement after 39 years with the Postal Service, working his way to the top job from a posting as a mail clerk in his native Pittsburgh, comes as three years of efforts in Congress to pass legislation to stabilize the agency have sputtered. Just after his departure  was made public, postal officials announced $5.5 billion in losses in the fiscal year that ended Sept. 30.

As the board met inside the L’Enfant Plaza headquarters, hundreds of postal workers demonstrated outside to protest post office closures and plans to shutter dozens of mail-sorting plants. Many have already closed, a change that has slowed delivery of mail across the country.

“He ignored the naysayers and went forward with his team and built a comprehensive plan for the future of the organization, made tough decisions, and executed against those decisions,” Board Chairman Mickey D Barnett said of Donahoe, 59. “No other organization has restructured itself so dramatically and on such a large scale, and continued functioning at such a high level.”

Brennan joined the Postal Service in 1986 as a letter carrier in Lancaster, Pa. Before she was chief operating officer in 2010, she served as vice president of the agency’s Eastern Area Operations.

She told the board that her promotion is the “honor of a lifetime, especially for one who comes from a postal family.” But like Donahoe, she will face a frustrating reality: While the Postal Service has been financed by mail revenue and not an appropriation from Capitol Hill since the 1980s, it cannot make many of its own decisions to cut service, increase revenue and enter new lines of business because Congress must approve.

As chief operating officer, Brennan oversees day-to-day operations from mail processing to delivery, which has undergone a dramatic shift in recent years as the volume of First Class mail has plummeted. Now the agency is hoping that delivery of packages — which recently expanded to Sundays — will act as a savior in an age of e-Commerce.

“Megan has led important initiatives to provide Sunday delivery services, improved tracking and greater predictability and reliability,” Barnett said. “She has also been highly successful in rationalizing our mail processing, delivery and retail operations.

Donahoe oversaw aggressive cuts to the heavily unionized postal workforce of clerks, letter carriers and other employees, losing about 220,000 through attrition and buyouts rather than layoffs. He grew the agency’s reliance on part-time and contract workers, who get lower pay and benefits than the career employees they replaced. He closed mail-sorting plants and some post offices and reduced hours at thousands of others. Package delivery has seen double-digit growth in recent years.

These moves angered postal unions and many lawmakers in Congress, who complained of cuts to jobs and service.

The Postal Service continues to hemorrhage billions of dollars a year, in part because of a congressional mandate to pre-fund health insurance for future retirees.

Donahoe pressed Congress repeatedly to pass legislation that would allow it to end the $5.6 billion annual payment and eliminate Saturday delivery of letters, among other cost cutting. But despite bipartisan cooperation at the committee level, lawmakers with union support and backing from the powerful mailing industry — which opposes a rate increase that legislation would make permanent, have blocked a bill from coming to the House or Senate floor. Donahoe became so frustrated with the lack of action that he moved to end Saturday delivery on his own, but the effort backfired in Congress and he was forced to back off.

House Oversight Committee Chairman Darrell Issa (R-Calif.) said in a statement that Donahoe “saw firsthand the changing landscape of the industry and was able to uniquely understand how USPS would need to evolve to serve their customers better.”

Donahoe said during a conference call Friday that the Postal Service has become a leaner, more technology-centric agency during his tenure.

“It’s time for somebody with a much longer time horizon with the organization to step in,” the postmaster general said.

Postal unions, which have largely disagreed with many of his decisions, welcomed news of his retirement Friday and expressed cautious optimism about working with Brennan.

“We look forward to working with her,” said National Association of Letter Carriers President Fredric Rolando during a conference call with reporters. “We hope that in addition to a new name, this change also involves a vision for the future that will enable the Postal Service to continue to adapt and to serve Americans and their businesses.”

This post has been updated.