Sen. Barbara Mikulski (D-Md.), who has served in Congress longer than any woman in history, announced Monday that she will retire after five terms in office, shocking Democrats in her state and setting off an immediate scramble to replace her.

Mikulski, 78, was the first woman to chair the powerful Appropriations Committee, a post she had to give up this year when the Democrats lost control of the Senate. A social worker turned politician, she has been a forceful presence on many pieces of legislation, passionately liberal on certain issues but also committed to working closely with Republicans.

[Mikulski’s retirement will set off wild Democratic scramble to succeed her]

"I came to the Senate with Barbara Mikulski and I have had no better friend in my time here than Barbara Mikulski," Senate Minority Leader Harry Reid (D-Nev.) said in a statement. "Barbara Mikulski’s voice has boomed through the halls of the Congress and has helped guide our nation through some of our country’s most trying times."

Mikulski said she decided against seeking a sixth term because she wanted to focus the next two years on helping her constituents, rather than spending her energy on another political campaign.

"Do I spend my time raising money or do I spend my time raising hell?" she said at the news conference. "Remember, for the next two years, I will be here, working the way that I do."

Mikulski made the announcement at the Inn at Henderson's Wharf in Fells Point, a waterfront boutique hotel on a cobblestone street not far, she said, from where her parents operated a neighborhood grocery store and her immigrant grandmother arrived in the United States.

The Baltimore native represented Maryland in Congress for 10 years, starting in 1977. First elected to the Senate in 1986, she began her career as an elected official on the Baltimore City Council, where she spent five years before coming to Congress.

“Barbara Mikulski is among the fiercest advocates [for] women and families that Washington has ever seen,” said Stephanie Schriock, president of EMILY's List, which works to get women into elected office and began its efforts by endorsing Mikulski some 30 years ago. “Barbara Mikulski’s legacy and the tremendous impact of her work will live on in the halls of Congress and across our country. The EMILY’s List community – now more than three million members strong – thanks her for her leadership and service.”

The retirement has the potential to reshape both Maryland politics and Congress's internal leadership. Several of the seven Maryland Democrats in Congress will likely take a look at the race, including Reps. Chris Van Hollen, Elijah Cummings, Donna Edwards, John Delaney and possibly Rep. John Sarbanes, whose father also served in the Senate.

Many in Maryland and on Capitol Hill have long viewed Van Hollen, a former aide on the Senate Foreign Relations Committee who lives in Montgomery County, as a likely candidate for Senate once Mikulski stepped aside. In the last six years, however, Van Hollen has become an increasingly loyal understudy of House Minority Leader Nancy Pelosi (D-Calif.), who has at times considered retiring herself. That means a Van Hollen bid for the Senate could also scramble the eventual race to replace Pelosi.

On Monday, Van Hollen called Mikulski "a true champion for the people of Maryland."

The Senate seat could also be tempting for former Maryland governor Martin O'Malley (D), who is weighing a 2016 presidential bid that has yet to get any traction. Other names being talked about on the Democratic side include Baltimore Mayor Stephanie Rawlings-Blake; U.S. Labor Secretary Tom Perez, a former Montgomery County Council member and state-level Cabinet secretary; and former Montgomery County delegate Heather Mizeur, a progressive who performed better than expected in last year’s Democratic gubernatorial primary.​

Names being floated on the Republican side include Rep. Andy Harris (R-Md.) and former Maryland governor Robert L. Ehrlich Jr. (R).

"Senator Mikulski has honorably dedicated her life to public service," Harris said in a statement Monday. "The assistance with federal agencies provided to constituents by Senator Mikulski and her staff is a model for elected officials at all levels."  Harris's office said the congressman was keeping all options open regarding whether he would run for Senate.

Word of Mikulski's retirement came as a surprise to many Maryland Democrats. As recently as last week, Mikulski was putting out word that she planned to seek reelection, said an aide to a senior Democratic elected official in Maryland, who requested anonymity to discuss the situation more freely.

Mikulski appeared rattled by the Democratic loss last year in the Maryland governor's race, when Lt. Gov. Anthony G. Brown (D) was beaten by Republican Larry Hogan, a little-known businessman from Anne Arundel County. Shortly after the the election, Mikulski summoned fellow Democrats to Annapolis for a meeting to talk about the party's future in a state where they should dominate, given a more than 2-to-1 advantage in party registration. Several participants at the meeting said Mikulski's aims included making sure that she would be able to shore up support for her reelection.

Mikulski has held positive job approval ratings in Maryland, making her a prohibitive favorite if she had chosen to run again. A Goucher College poll in March 2014 found about twice as many approving as disapproving of her performance as senator, 50 percent vs. 27 percent, with 22 percent holding no opinion. In 2012, a Washington post poll found ever greater approval of Mikulski -- 65 percent, while 20 percent disapproved (fewer in that survey had no opinion). In 2010, Mikulski won re-election with 62 percent of the vote, easily defeating Republican Eric Wargotz. Mikulski’s approval ratings were more positive than those measured in the Goucher poll for Sen. Ben Cardin (D). Forty-one percent of people in that poll approved of Cardin's performance, while 28 percent disapproved.

Paul Kane, Chris Cillizza and Scott Clement contributed to this report.