Marge Tartaglione, the feisty 78-year-old great-grandmother who has been at the reins of the city election machinery for the past 36 years, appears in Tuesday's Democratic primary to have lost her bid for a 10th term.

Stephanie Singer, a brainy mathematician and Center City ward leader who made Tartaglione the main target of her campaign, led the balloting for city commissioner by more than 5,000 votes.

The other spot on the Democratic ticket was apparently won by Anthony Clark, 51, Tartaglione's quiet sidekick in the commissioner's office the last four years.

With 95 percent of the vote counted, Clark had a 1,011 vote lead over Tartaglione in the unofficial count. The numbers did not include any votes from absentee or provisional ballots, potentially large enough to swing the election back in Tartaglione's direction.

In the other row office contested in Tuesday's primary, State Rep. Jewell Williams, 53, a North Philadelphia ward leader and chairman of the city's delegation in the state House, easily defeated two challengers to capture the Democratic nomination for sheriff.

Assuming that both Democratic candidates – likely Singer and Clark – ride the city's 6-1 Democratic registration edge into office, they'll be joined by one Republican commissioner – either incumbent Joseph J. Duda, 71, who has held the Republican commissioner's seat for 16 years, or Al Schmidt, 39, part of a GOP insurgent movement unhappy with the leadership of General Counsel Michael P. Meehan.

The Republican Party machinery had tried to shut down Schmidt by backing a slate that included Duda and Marie Delany, executive director of a residence for homeless women with children.

But Schmidt nearly matched Duda's vote, putting both of them on the ballot - effectively running against each other - in the November general election. Delany was about 1,500 votes behind.

At least three different factors contributed to Tartaglione's apparent defeat:

Her participation in the city's deferred-retirement program, which paid her $288,000 at the beginning of her current term in 2008. She took advantage of a city solicitor's opinion to "retire" for a day, collect $288,000 in DROP money and begin another term the next day.

The hotly-contested City Council races in the 6th district, where Tartaglione decided to oppose Bobby Henon, the political director of the electricians' union Local 98, incurring the wrath of union leader John Dougherty, and the 7th district, where Tartaglione's son-in-law, Carlos Matos, was aligned with Maria Quinones Sanchez, against many of the district's other ward leaders.

The aggressive campaign run by Singer. In a weekend mailing, she called Tartaglione "an embarrassment to Philadelphia," criticizing her for DROP, for taking a 5 percent pay raise last year when most elected officials agreed to pass it up, and for hiring her daughter, Renee Tartaglione, as chief of staff. Renee was forced to give up the job last year after the city Board of Ethics documented blatant violations of the city's ban on political activity.

In the sheriff's race, Williams won 60 percent of the vote against two opponents – John Kromer, a former city housing director, who had vowed to work toward abolishing the sheriff's office if elected, and Jacque Whaumbush, a former chief deputy sheriff.

Kromer's message resonated with civic groups like the Committee of 70, which contends that the city could save money by distributing the sheriff's duties to other city agencies.

But Williams locked up wide support within the city's Democratic organization, and in the end, even proponents of abolishing the office, like Mayor Nutter, sat out the race, endorsing no one.

In the fall Williams will face Republican Joshua West, 35, a paralegal and captain in the Army National Guard, vying to replace Sheriff John Green, who retired at the end of last year.

Ron Donatucci, 63, the city's register of wills since 1980, was unopposed for the Democratic nomination to seek his ninth term in office, responsible for handling the paperwork on wills and estates and collecting inheritance taxes for the state of Pennsylvania.

With the Democratic registration edge, Donatucci is an overwhelming favorite to win the general election, unless voters get charged up over his participation in the city's deferred-retirement program, known as DROP, which promises to give him a lump-sum payment of $368,000 early next year.

Donatucci's Republican opponent is Linda Wolfe Bateman, 58, of Roxborough, an inheritance tax specialist with the state Revenue Department for the past 10 years.

Contact Inquirer staff writer Bob Warner at 215-854-2611 or warnerb@phillynews.com