NEW YORK (AP) — U.S. Rep. Jerry Nadler, who twice led fights to impeach former President Donald Trump, defeated U.S. Rep. Carolyn Maloney in a Democratic primary Tuesday after a court forced the two veteran lawmakers into the same New York City congressional district.

Nadler’s victory ends a 30-year run in Congress for Maloney, who battled to get government aid for people sickened by clouds of toxic soot after the Sept. 11 attacks.

The unusual fight between incumbents who have spent decades working together was the result of a redistricting process that lumped Nadler’s home base on the west side of Manhattan together with Maloney’s on the east side, with neither willing to run in another part of the city.

In his victory speech, Nadler said he and Maloney “have spent much of our adult lives working together to better both New York and our nation. I speak for everyone in this room tonight when I thank her for her decades of service to our city.”

Nadler also defeated Suraj Patel, a 38-year-old lawyer and lecturer at New York University who has now failed to advance out of a Democratic congressional primary in three straight tries.

Nadler, 75, was first elected to Congress in 1992. As chair of the House Judiciary Committee, he led both impeachments of Trump. Nadler was buoyed in the last weeks of the campaign by endorsements from The New York Times and Senate Majority Leader Chuck Schumer.

He pledged he would go back to Congress “with a mandate to fight for the causes so many of us know to be right,” including abortion access and climate change.

Maloney, 76, also first elected in 1992, is the first woman to chair the House Oversight and Reform Committee. She is known for her longtime advocacy for Sept. 11 first responders seeking compensation for diseases they attribute to contamination from the destruction of the World Trade Center. She wore a firefighter’s jacket on Capitol Hill and at the 2019 Met Gala.

Maloney said women in politics still face “misogyny” today, something she said she experienced herself in her campaign this year.

“I’m really saddened that we no longer have a woman representing Manhattan in Congress,” Maloney added. “It has been a great, great honor and a joy and a privilege to work for you.”

House Speaker Nancy Pelosi called Maloney “a champion for integrity" in a statement on the race and said “her longtime public service will be profoundly missed in the Congress."

Pelosi also congratulated Nadler, saying he “has been a commanding force for freedom and justice" and that the country would “greatly benefit from his continued leadership."

Few policy differences between Nadler, Maloney and Patel emerged during the primary campaign.

All support abortion rights, the Green New Deal and tighter restrictions on gun ownership. Patel argued that Nadler’s and Maloney’s generation failed to achieve Democratic goals like codifying Roe v. Wade and should cede to new blood.

Nadler and Maloney countered that their seniority in Congress brings clout that benefits New Yorkers.

Friends for many years, the two Democrats lamented having to run against each other — something that only happened after a court redrew the boundaries of the state’s congressional districts after concluding the legislature botched the process.

“I didn’t want to run against my good friend, Jerry Nadler,” Maloney said at a recent debate. “We have been friends and allies for years. Unfortunately, we were drawn into the same district.”

Still, on the campaign trail Maloney said that as a woman, she would fight harder to protect abortion rights than Nadler.

Asked at a debate how his record differed from that of Maloney, Nadler cited his votes against the Iraq War and the Patriot Act, and in favor of the Iran nuclear deal. Maloney, also elected to Congress in 1992, voted the other way on all three.

Maloney also came under fire from her opponents for her past positions on vaccines, including in 2006 when she introduced legislation directing the federal government to study the debunked theory that vaccines can cause autism. Maloney insisted that she supports vaccines and regretted having ever questioned vaccine safety.

The primary winner in the overwhelmingly Democratic district will face Republican Michael Zumbluskas in the November general election.

Copyright 2022 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.