Stephanie Singer's short and rocky career as a Philadelphia city commissioner hung on just a handful of signatures as a judge heard testimony late into Thursday night on a challenge aimed at removing her from the ballot.

Singer needs 1,000 valid signatures from registered Democrats on nomination petitions to remain on the party's May 19 primary ballot in her bid for a second term. She submitted 1,485 signatures.

Richard Hoy, the lawyer for the challengers, said late Thursday that Singer had 1,005 signatures remaining after more than 400 were withdrawn by her or stricken by Common Pleas Court Judge Joel Johnson during the four-day hearing.

Hoy challenged 1,124 of Singer's signatures and predicted that she would have fewer than the required 1,000 by the time Thursday's hearing ended.

Hoy has questioned the veracity of some voters' signatures on Singer's petitions, along with the addresses and party affiliations they listed. He has also challenged the accuracy of addresses listed by at least one person who circulated the petitions on Singer's behalf.

Hoy called Singer's petitions "atrocious," especially since her role as one of three elected city commissioners is to oversee elections in Philadelphia.

"She knows better," Hoy said.

Hoy, representing three Democratic voters, is being assisted in the challenge by Nick Custodio, a political consultant working for Lisa Deeley, a candidate for city commissioner in the Democratic primary.

Deeley, who has worked for City Controller Alan Butkovitz and Councilman Bobby Henon, has strong Democratic Party support.

Singer's lawyer, Charles Goodwin, denounced Hoy's legal challenges as "nearly all baseless."

"It is the kind of thing no one should put in front of a judge," Goodwin said.

Singer, 50, a mathematics professor and former ward leader, insists that she has more than 1,000 valid signatures.

Each side has predicted an appeal to the state Commonwealth Court if it loses.

Singer ran as a reformer in 2011, defeating then-City Commissioners Chairwoman Marge Tartaglione's bid for a 10th four-year term. Singer was elected chairwoman, but things turned stormy after that. She quickly clashed with the two other commissioners, fellow Democrat Anthony Clark and Republican Al Schmidt.

Clark and Schmidt voted one day after the 2012 general election to oust Singer as chairwoman. They made Clark chairman and Schmidt vice chairman, effectively icing Singer out of the panel's key decisions.

Singer last year attempted to file a complaint with District Attorney Seth Williams against Clark and Schmidt, claiming they had violated technical rules on when to certify the winners of candidates for Democratic and Republican committee posts.

Singer also clashed last year with U.S. Rep. Bob Brady, the city's Democratic Party chairman, about how a special-election candidate for an open City Council at-large seat had been selected.

On Monday, Singer's former chief deputy, Dennis Lee, was removed from the Democratic primary ballot for city commissioner because of problems with how he filed to be a candidate.

Common Pleas Court Judge Chris Wogan's ruling called Lee's explanations for his legal troubles "entirely without credibility."

Lee filed his notice of appeal Thursday in Commonwealth Court.