Sen. Barbara A. Mikulski, the Maryland Democrat who is the longest-serving woman in congressional history, will depart Capitol Hill the way she arrived — with a sharp tongue, an unabashed liberalism and a mission to make the Senate a place where women belong.

Mikulski surprised many colleagues Monday with her announcement that she will leave the Senate next year after five terms. In good health at 78, the senator said she wants to shift her focus: “Do I spend my time raising money? Or do I spend my time raising hell?”

“There’s nothing gloomy about this announcement,” she said at a news conference in Baltimore, not far from where she grew up. “I’m not frustrated with the Senate.”

Mikulski, the first woman to chair the powerful Appropriations Committee, had to give up her post when Democrats lost control of the chamber in November. And she seemed rattled when then-Lt. Gov. Anthony G. Brown lost to Republican Larry Hogan in last fall’s governor’s race despite the Democrats’ better than 2-to-1 advantage in party registration.

But Mikulski’s popularity has held strong in Maryland, and in January, she started her annual tour of every county in the state — feeding the widespread belief she would seek a sixth term, said Maryland House Speaker Michael E. Busch (D-Anne Arundel).

Sen. Barbara Mikulski (D-Md.), who announced her retirement on Monday, is the longest-serving woman in Congress.

Mikulski’s decision set off a potentially wild scramble to replace her. “Maryland has a lot of talent — and they’ll be telling you about it within the next 10 minutes,” Mikulski quipped at her announcement.

In the Senate, Mikulski was never one for grand legislative initiatives or globe-trotting foreign policy interests. She focused on getting things done for her constituents, pushing for highway funding, environmental safeguards for the Chesapeake Bay and security at the Port of Baltimore.

Often dubbed the Senate’s meanest member, she was regularly described as “prickly” by friends and foes alike. Yet she became a role model for generations of women in politics — in both parties.

She was the first Democratic woman — and second woman overall — elected to the Senate who did not succeed her husband or father in elective office. (Paula Hawkins, a Florida Republican, was elected in 1980.)

“While I was the first, I didn’t want to be the only,” she said Monday. She choked up briefly as she thanked voters who supported her through nearly five decades in office.

“Her leadership serves as an inspiration to millions of women and girls across the globe to stand up and lead,” President Obama said in a statement. . . . Barbara has wielded her gavel and used her booming voice to advocate on behalf of paycheck fairness, childcare, health care, education, women’s rights and countless issues that have contributed to the strength of America’s families.”

Among the potential candidates to replace Mikulski are two former governors, Martin O’Malley (D) and Robert L. Ehrlich Jr. (R), and U.S. Labor Secretary Thomas Perez, a Democrat from Takoma Park. And the list also includes several House members: Reps. Chris Van Hollen and John Delaney, both Montgomery County Democrats; Donna F. Edwards, a Prince George’s County Democrat; John Sarbanes, a Democrat from Baltimore County and son of a former senator; and Andy Harris, a Republican from the Eastern Shore.

The Baltimore Sun once described Mikulski as “a vicious terrier,” but it added, since this was in an editorial endorsing her reelection, that “she’s our terrier. And . . . she’s delivered, big time.”

Colleagues sometimes referred to her as “the little general in pearls” — she’s 4-foot-11 — but Mikulski called herself “a social worker with power” and said her purpose as a politician was “to serve people with their day-to-day needs.”

On the Hill, aides traded stories of Mikulski’s brash manner, such as how she used her purse as a battering ram to clear her way to the Senate floor. As she alighted from the Capitol elevator, she would press through packs of reporters, staffers and other senators, loudly yelling “Excuse me! Excuse me!” while swinging her purse to open a path. Aides also tell of Mikulski snapping at them if they failed to position her step-stool properly behind the lectern at events where she was to speak.

“What makes her good is what makes her impossible,” said a former staffer who asked not to be named, in order to speak frankly about her ex-employer. “She’s as angry, short and critical in fighting for issues as she is as a boss.”

A longtime friend, Maggie L. McIntosh, a Democratic state delegate from Baltimore, said the senator consulted with a few relatives before making her decision.

“My first reaction was to be really sad,” said McIntosh, who worked for Mikulski two decades ago. “But then I realized that nobody is going to keep her from speaking out. She’s leaving on her own terms.”

The daughter of Polish American grocery store owners in Baltimore, Mikulski praised the nuns who instilled confidence in her at the Institute of Notre Dame, a Catholic school for girls where she was on the debate team. (The school also produced House Minority Leader Nancy Pelosi.) Mikulski recalled a nun telling her, “You can do it, Barb — get out there and roll those Jesuit boys!”

Mikulski has said she considered going into the convent because the nuns “were so beautiful. They all looked like Ingrid Bergman or Loretta Young.”

Instead she went to work for child protective services, and she entered public life by organizing neighbors to stand up against a plan to plow a 16-lane highway through Baltimore’s old ethnic communities. She was victorious. In 1971, she won her first campaign, beginning a five-year stint on the Baltimore City Council.

“I thought, ‘Gee, why should I be out there knocking on doors trying to get inside?’ ” she said in an interview in 1989 on C-SPAN. “Why not run for City Council and be inside, opening the doors for the people?”

She said her aim was to help people get a leg up; her model was her mother, whom she saw extending credit to customers when steelworkers in the neighborhood went on strike.

Although she relished her reputation as a bulldog, Mikulski also devoted herself to building bipartisan ties among the Senate’s women. “There used to be a Senate rule that women had to wear skirts on the Senate floor,” said Sen. Patty Murray (D-Wash.), “but when Senator Mikulski decided that she was going to wear pants while casting her votes, it was the rule that had to change, not her.”

Mikulski was proud of her Republican colleague Kay Bailey Hutchison (Tex.) for getting the Senate gym to admit women, though Mikulski said she never minded not having access to the treadmills: “I spent the time getting worked up instead of working out.”

She and Hutchison teamed up to push for quality standards for mammograms, funding for breast cancer research and a stronger space program.

For more than two decades, Mikulski has held what she called “power workshops” for women newly elected to the Senate. She also hosts dinners every other month for the Senate’s women — and she enforces the rules: no staff, no memos, no leaks. As the dean of the 20 women now in the Senate, she urged fellow female senators to “disagree without being disagreeable. We are not a caucus, but we are a force,” she said.

She spent years pushing for the Lilly Ledbetter Fair Pay Act, a bill designed to ensure that women receive equal pay for equal work. And she was particularly proud of writing a law that helps keep seniors from going bankrupt while caring for a spouse who is in a nursing home.

Vice President Biden said in a statement that Mikulski “brought the nation’s attention to the need for shelters for victims of domestic violence, helping countless women escape the worst prison on earth — the four walls of their own home.”

From the start, Mikulski had to deal not only with old-fashioned customs in the Senate but also with colleagues who were stuck in another era. In 1987, Sen. Pete Domenici (R-N.M.) joked to the Alfalfa Club that he was so charismatic that “women often throw their panties at me when I speak. . . . I just don’t know what got into Senator Mikulski.” She called the joke outrageous and insulting, and Domenici apologized.

A couple of years later, the District’s Cosmos Club — long closed to women — changed its policy and invited Mikulski to join. “I said no,” the senator said. “I’ve joined the most exclusive club in the world, and you pay your dues by getting out and working for this country.”

When members of Congress met on the Capitol steps after the terrorist attacks on Sept. 11, 2001, Mikulski led them in a stirring rendition of “God Bless America.”

Growing up with parents who strongly backed President Franklin D. Roosevelt’s efforts to support the poor and unemployed, she believed in government helping the less fortunate. She was a vigorous advocate for abortion rights and opposed the extensive use of outside contracting for government work. But she also worked with Republicans to craft the Clinton-era welfare reform.

“I’m a doer,” she said in the C-SPAN profile, tracing her style to her roots as a Girl Scout. “I hope I’m earning my badge in good government.”

She said Dorothy Day, the leader of the Catholic Worker movement, and Saul Alinsky, the community organizer, inspired her. Ultimately, though, she was disappointed by Alinsky’s philosophy, which she described as “organizing around the anger, frustrations and bitterness of people.” She came to prefer Day’s quieter approach, “trying to find the hopes of people. Don’t make other people the enemy.”

Inspired by Michael Harrington’s book about poverty, “The Other America,” Mikulski has always lived modestly; she has a net worth of only about one-tenth that of the average senator, according to financial disclosure records.

Mikulski, who never married, has lived in Baltimore throughout her time in Congress, commuting daily to the District. Fiercely loyal to her home city, she made little effort to connect with voters in the D.C. suburbs, even as Montgomery and Prince George’s became the state’s most populous counties.

She wrote mystery novels with a former Los Angeles Times reporter, featuring the adventures of a freshman senator from Pennsylvania named Eleanor “Norie” Gorzack. Kirkus Reviews labeled her 1996 novel, “Capitol Offense,” “a feeble attempt at a Washington suspense novel,” but the New York Times’ reviewer said Mikulski had managed “to pull off something rare indeed — a novel that remains interesting and involving while also deftly touching on important issues.”

She announced her departure with little fanfare. Mikulski stood with neither friends nor family; there were no hugs or tears. When it was over, she drove down to the District to continue her work.

Paul Kane and Sean Sullivan contributed to this report.