A federal court threw Rep. John Conyers a lifeline Friday with a decision that stops Michigan election officials from throwing the veteran lawmaker off the primary ballot.

The possibility of the 25-term Democratic congressman — who would become the longest-serving member in the House if he wins another term — fell into doubt when election officials said Conyers failed to secure enough legitimately collected signatures on his petitions for a spot on the ballot.

Several of his signature gatherers had failed to meet Michigan requirements and that left the 85-year-old congressman far short of the 1,000 signatures he needed to get on the ballot.

But Conyers' lawyers, as well as the American Civil Liberties Union, argued that the court should heed a 2008 appellate court precedent that struck down an Ohio requirement similar to Michigan's. That appeals court said it was unconstitutional for Ohio to place requirements on such signature gatherers.

If U.S. District Judge Matthew Leitman, an Obama appointee, had ruled against Conyers Friday, the congressman would have had to undertake a write-in campaign to win the Democratic primary.

He's not out of the woods yet. Michigan officials can appeal the judge's preliminary decision that orders them to put Conyers on the ballot.

If Conyers stays on the ballot and wins another term. he's poised to become the dean of the House since Rep. John Dingell, also of the Michigan delegation, has announced his retirement.

Conyers has been in Congress nearly 50 years, taking office in 1965.

During those years, Conyers has built a substantial legacy, much of it on civil rights issues. He helped win passage of the 1965 Voting Rights Act and co-founded the Congressional Black Caucus.

He played a central role in the creation of the Martin Luther King Jr. federal holiday and oversaw passage of major hate-crimes legislation in 2009 during his time as House Judiciary Committee chairman.

His advancing age has slowed him, however, and questions about his ability to perform his role as a congressman have multiplied.

Such doubts led to one of the most remarkable endorsements ever by a newspaper because of its backhandedness. In 2012, the Detroit Free Press wrote:

"John Conyers gets our endorsement, but it is mostly with the hope that he will soon retire from Congress and the district will produce a more viable alternative."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.