The Koch brothers' astroturf operation, Americans for Prosperity (AFP), and Wisconsin Family Action (WFA) are exuberant over Brian Hagedorn's apparent razor-thin victory over Lisa Neubauer on Tuesday for a seat on the Wisconsin Supreme Court.

Hagedorn is winning by less than 6,000 votes, or less than a half a percent, the Associated Press is reporting. If the margin holds, Wisconsin law allows for a recount, but Neubauer would have to foot the bill.

Hagedorn has declared victory in the race, but Neubauer has not conceded and is considering a recount. The eventual winner will replace longtime Supreme Court Justice Shirley Abrahamson who announced her retirement last year.

If the Kochs' Hagedorn is elected, the Wisconsin Supreme Court will move one seat further to the right with a 5-2 majority.

Kochs, Christian Right Rejoice

Hagedorn's biggest supporter in terms of money was the Republican State Leadership Committee (RSLC), which took out $1.3 million in TV and digital ads. The RSLC funnels millions in corporate money into state campaigns, and counts tobacco companies, the US Chamber of Commerce, the Judicial Crisis Network, pharmaceutical giants, and Koch Industries among its top funders.

But it was the Kochs and the Christian Right group Wisconsin Family Action who are credited with Hagedorn coming out on top. AFP spent over $200,000 on canvassing efforts and mailings. According to its State Director, Eric Bott, AFP talked to more than 750,000 voters and sent out over 1.5 million targeted mailings in the seven weeks up to the election.

"There's no question our engagement made a huge difference," Bott said.

WFA spent more than $25,000 on mailings and brochures for Hagedorn as well. WFA thanked AFP for its efforts and extended "a hearty congratulations and thanks to Brian and his family for their hard work and steadfast commitment to staying the course despite the unjust attacks on their personal lives and their religious beliefs," in a press release following the election.

One Wisconsin Now revealed that Hagedorn founded a school that prohibits anyone working there from being in a same-sex relationship and could expel students who identify as LGBTQ.

The Milwaukee Journal Sentinel also exposed an old blog Hagedorn wrote from 2005 where he addressed his "fellow soldiers in the culture wars," stating that "the idea that homosexual behavior is different than bestiality as a constitutional matter is unjustifiable."

Following the revelations of his hateful stance towards the LGBT community, the Wisconsin Realtors Association revoked its endorsement of Hagedorn saying, "The real estate related issues that served as the basis for our endorsement have been overshadowed by other, non-real estate related issues -- issues with which we do not want to be associated and that directly conflict with the principles of our organization and the values of our members."

The U.S. Chamber of Commerce, which often funnels money to right-wing candidates through the Wisconsin Manufacturers and Commerce, followed suit, according to the Journal Sentinel.

Hagedorn and other influential right-wing leaders in the state, such as Wisconsin Institute for Law and Liberty's Rick Esenberg, framed the anti-LGBT Hagedorn revelations as attacks on "religious tolerance." Esenberg, who donated to Hagedorn, regularly brings cases in front of the Wisconsin Supreme Court.

WFA riled its base to support Hagedorn, claiming he had been "viciously and unjustly attacked," and warning of dire results if he lost the election and liberals won the next 2020 Supreme Court election. If that happens, there will be a "deluge of cases...against faith-based adoption agencies, cases against Christian florists and photographers," said WFA President Julaine Appling. "You could probably kiss aspects of voter ID, or concealed carry, or right-to-work, or portions of Act 10 goodbye."

Two hours prior to polls closing, WFA attempted to motivate Twitter followers by adding that Neubauer was endorsed by "pro-abortion" Planned Parenthood and "pro-LGBT" Human Rights Council.

WFA has been active in pushing a Christian Right agenda in the state for years, as the Center for Media and Democracy (CMD) reported last year in Conquering the Courts: The Religious Right's Fight to Rig the Rules and Undermine Judicial Independence. WFA is an affiliate of the Family Policy Alliance, a national network of 40 groups in 38 states that spends millions to influence state legislation and elect socially conservative candidates.

In 2006, WFA partnered with Family Research Institute of Wisconsin and Focus on the Family to spend heavily on a media campaign for a constitutional amendment to ban gay marriage. The amendment passed but was overturned in 2014 when the Seventh Circuit Court of Appeals declared the marriage ban unconstitutional.

In 2008, WFA and Wisconsin Right to Life worked together to unseat Louis Butler on the Supreme Court, which resulted in the election of Michael Gableman.

WFA also played a big role in former Governor Scott Walker's dark money operation in 2011 and 2012, channeling $1.2 million in cash from Wisconsin Club for Growth and Citizens for a Strong America into recall elections.