(WHTM) – The contentious race for a seat on Pennsylvania’s Supreme Court came to a close Tuesday with Democrat Dan McCaffery defeating Republican Carolyn Carluccio\.

The race between McCaffery and Carluccio largely played out over the airwaves with millions of dollars being spent on negative ads. Both candidates have denied the allegations being aired and participating in the airing of those attack ads.

The seven-seat high court currently has a majority of four justices elected as Democrats. Two other justices were elected as Republicans.

One seat is open following the death last year of Chief Justice Max Baer, who was months away from the mandatory retirement age of 75.

Judicial elections in Pennsylvania occur in odd-numbered years to 10 year terms. They may hold an unlimited number of terms until they reach the mandatory retirement age.

McCaffery, a Superior Court judge and former assistant district attorney in Philadelphia previously ran for district attorney in 2009 and lost in the primary. He also ended a brief candidacy for state attorney general in 2012 before winning a race for a Common Pleas Court judge position in Philadelphia.

Carluccio is the president judge of Montgomery County Court and previously served as both a former federal prosecutor and chief public defender of Montgomery County.