HARRISBURG - Election boards in Pennsylvania's 67 counties are poised to start recounting hundreds of thousands of ballots in a tightly-contested statewide judicial primary race.

Secretary of the Commonwealth Carol Aichele on Thursday ordered a mandatory recount in the Democratic primary election for Commonwealth Court judge.

Doylestown lawyer Kathryn Boockvar beat her opponent, Barbara Behrend Ernsberger, a Pittsburgh lawyer, by 2,116 votes in the May 17 election.

The margin of victory falls below one half of one percent of the total vote - the threshold for triggering an automatic recount under the law.

Ernsberger said she decided not to waive her right to a recount so that Democratic voters would have a clear decision on who won.

"I believe the legislature put the recount mechanism in here so that everyone knows the results," said Ernsberger. "There can be mistakes in counting and this recognizes a race this close should be recounted."

County boards of elections must now begin the labor-intensive process of counting 621,132 ballots.

Boockvar said she is confident she will prevail and thinks spending hundreds of thousands of dollars to conduct a recount with margins of several thousand votes is a "burden" on election officials and taxpayers.

"If we were 50 votes apart I'd understand, but the patterns of the last decade show differently," she said. "No similar races has been changed as a result."

Aichele said the recount ensures government openness and accountability.

"There is nothing more important to our system of government than a transparent election process in which our citizens have confidence," she said in a statement.

The last statewide recount - in a November 2009 contest for Superior Court race - cost the state $542,000.

By law the results of the current recount must be presented to the Department of State by June 8.