The field is set for a crowded primary race to replace the late representative Elijah E. Cummings, an outspoken voice for civil rights and social justice during his two decades in Congress who fought for federal funding and programs to aid his beloved Baltimore.

A top elections officials said 24 Democrats and eight Republicans registered by Wednesday’s deadline for the Feb. 4 special election that, because of Democrats’ overwhelming majority in the district, will probably determine who serves the remainder of his term. At least five candidates appear to have the name recognition, fundraising potential and experience to be competitive, political analysts said.

The Democratic race pits the late congressman’s widow, Maya Rockeymoore Cummings, a policy consultant who recently resigned as chair of the state Democratic Party, against one of his oldest friends, Kweisi Mfume, a former NAACP leader who represented the district in Congress from 1987 to 1996.

Among state lawmakers, Sen. Jill P. Carter (D-Baltimore City), a progressive former public defender, and Dels. Talmadge Branch (D-Baltimore City) and Terri L. Hill (D-Howard) could also tap networks in their districts to prove formidable.

Political observers are closely watching the contest to succeed a lawmaker who rose to national prominence as a powerful critic of President Trump. The abbreviated campaign has the potential for sharp exchanges: Already, Rockeymoore Cummings has accused Mfume of approaching her about politics just days after her husband’s death, a charge he denies.

Mfume has the backing of veteran political consultant Larry Gibson, a longtime friend of Elijah Cummings. The late congressman’s grown daughters — stepdaughters to his widow — lined up behind another candidate, Harry Spikes, who worked in Cummings’s congressional office for 15 years. Spikes, Rockeymoore Cummings and Mfume all eulogized Cummings at his Oct. 25 funeral.

Maryland’s 7th District elected the state’s first African American member of Congress, Democrat Parren J. Mitchell, a civil rights icon and founding member of the Congressional Black Caucus, who served from 1971 to 1987. Since then, the district has become known for electing strong African American leaders with a moral conscience.

“When Parren Mitchell left office and Mfume came, they said, ‘They’ll never fill his shoes.’ And when congressman Cummings came, people said, ‘Oh, he’ll never fill his shoes.’ I don’t know if the task is so much to fill shoes as to get in there and do what you need to do,” said Vernon Simms, Cummings’s longtime chief of staff, who says he will stay neutral in the race.

Cummings — who died of cancer, according to his family — built a national reputation as chairman of the House Oversight and Reform Committee. Candidates will compete to continue his legacy of speaking truth to power while representing most of Baltimore, as well as large swaths of Baltimore and Howard counties. The district’s 510,000 registered voters are roughly split between the city and the two counties combined, according to the Maryland State Board of Elections.

“Good luck being the person running to replace Elijah Cummings,” said Todd Eberly, a political science professor at St. Mary’s College of Maryland. “They’re not going to get somebody who had the clout and seniority that he had, but [voters] very much want someone who could move into that role quickly.”

With only 2½ months until the primary election, candidates who can rely on established networks to drive turnout will have an advantage. Analysts say it will take $500,000 to $1 million to run enough TV ads to have an effect on voters.

National groups are paying close attention to the special election in a state that has not had a woman in Congress since the end of 2016, when Rep. Donna F. Edwards (D) gave up her seat in an unsuccessful bid to replace retiring Sen. Barbara A. Mikulski (D).

The Maryland congressional delegation and state legislators representing Baltimore have not endorsed in the race, a sign that there is no heir apparent. The Democratic Congressional Campaign Committee also will not publicly support a candidate in the primary election, a spokeswoman said.

Emily’s List, which endorses female candidates who support access to abortion, backed Rockeymoore Cummings’s brief campaign for governor in 2017 and helped her team prepare to launch her congressional campaign. “We’re excited to see strong women like Maya Rockeymoore Cummings running for Congress,” Emily’s List spokeswoman Mairead Lynn said in a statement.

Widows have succeeded their husbands in Congress on 47 occasions, according to the Center for American Women and Politics at Rutgers University.

The powerful eulogy Rockeymoore Cummings delivered at her husband’s funeral, streamed live on C-SPAN, put her in the national spotlight, as did a prime-time interview she did with MSNBC’s Rachel Maddow.

Before launching her policy consulting firm, she was chief of staff to then-Rep. Charles B. Rangel (D-N.Y.) and worked a variety of other jobs in Washington, including for the National Urban League and the Congressional Black Caucus Foundation.

Mfume is well known in Baltimore for transforming a troubled childhood into a life of civil rights activism and public service. He dropped out of high school, was a teenage father and turned to crime after his mother died of cancer in his arms. After turning his life around, he was elected to the Baltimore City Council and succeeded Mitchell in Congress before leaving to lead the NAACP.

Were he to return to Congress, Mfume would probably regain some of his seniority, although House Democrats would make the final determination.

The rare open seat offers state lawmakers the chance to run without forfeiting their spots in Annapolis.

Carter, a progressive known for her independence, was a public defender and grew up in a family of civil rights activists. She says Cummings called her the “People’s Champion.”

Carter pushed police reform, the expungement of criminal records and additional investments in city schools for years before the legislature took up those issues. Her public questioning of deals between the University of Maryland Medical System and its board members this year prompted a Baltimore Sun investigation that led to the downfall of the mayor, Catherine E. Pugh, who resigned in May.

As House majority whip for 12 years, Branch has acted as a behind-the-scenes power broker responsible for securing the votes on contentious legislation. He worked for Mitchell in the 1980s.

Branch’s 22-year-old grandson was murdered outside a Baltimore convenience store in 2017. As a result, Branch advocated for more than $3 million for the city’s Safe Streets program.

Hill, a plastic surgeon, graduated from Harvard University and earned a medical degree from Columbia University. A relative newcomer to politics, she pushed a ban on tackling in youth football, which ultimately did not pass.

A fourth state lawmaker also filed to run late Wednesday: Del. Jay Jalisi (D-Baltimore County), a physician who was formally reprimanded in the General Assembly this year after reports that he had mistreated his legislative staff.

Other Democrats are: T. Dan Baker, Alicia D. Brown, Anthony Carter Sr., Matko Lee Chullin III, Jay Fred Cohen, Nathaniel Costley, Jermyn Davidson, Darryl Gonzalez, Mark Steven Gosnell, Leslie E. Grant, Dan Hiegel, F. Michael Higginbotham, Paul V. Konka, Adrian Petrus, Saafir A. Rabb, Charles U. Smith and Charles Stokes, according to the Board of Elections.

The Republicans are: Christopher M. Anderson, James C. Arnold, Ray Bly, Brian L. Brown, Reba A. Hawkins, Kimberly Klacik, Liz Matory and William Newton.

The candidates nominated in the primary race will appear on the special general election ballot on April 28, the same day as the statewide 2020 primary. The general election winner will serve out the remainder of Cummings’s term, through the end of 2020.

Candidates who wish to seek the two-year term that begins in 2021 have until Jan. 24 to file for the April 28 primary.

This story has been updated with new candidate names and to correct the number of Democrats and Republicans seeking the 7th District seat. Earlier versions incorrectly said Mfume spent time in jail. He did not.

Ovetta Wiggins contributed to this report.