Embattled Manhattan District Attorney Cyrus Vance Jr. was re-elected amid controversy surrounding his having declined to prosecute cases in which defense attorneys contributed to his campaign. Vance won overwhelmingly, despite a last-minute write-in campaign from former Brooklyn prosecutor Marc Fliedner.

Cyrus Vance Jr. secured re-election in 2013 with 84.3 percent of the vote, facing Republican Peter Gleason. With no formal opposition this time, Vance secured re-election easily. The total vote count will come in in the coming days, as write-in ballots can take over a week to fully count. Current unofficial totals from the New York City Board of Elections showed Vance with just over 90 percent of the vote, with the remaining 10 percent going to as-of-yet unnamed write-in candidates.

“I’d like to thank the people of Manhattan for electing me to a third term as your District Attorney. Over the past eight years, we have worked together to make our justice system fairer, more efficient, and more effective for all New Yorkers,” Vance said in an emailed statement. “In the coming four years, we will build on the tremendous progress we have made around criminal justice reform and continue to combat violence against women, cybercrime, gun violence, terrorism, and the opioid epidemic.”

Vance was cruising to a third term with his candidacy largely staying under the radar until reports began to surface about decisions not to prosecute or pursue investigations of well-connected clients.

ProPublica reported that Vance declined to prosecute Donald Trump Jr. and Ivanka Trump in 2015 after Donald Trump Sr.’s personal attorney Marc Kasowitz donated $25,000 to Vance’s campaign. Vance met personally with Kasowitz and overruled his own prosecutors on the case. He eventually returned the donation to avoid the appearance of a conflict of interest, but Kasowitz subsequently made an even larger $31,993 contribution.

The day after the ProPublica story, following the New York Times’ report about sexual assault allegations against Harvey Weinstein, International Business Times reported that Weinstein’s longtime lawyer David Boies similarly gave Vance $10,000, months after Vance declined to prosecute Weinstein for groping Italian model Ambra Battilana Gutierrez.

The Manhattan District Attorney’s office has said that Boies’ contribution played no role in the Weinstein investigation because Boies was not representing Weinstein in the matter. However, an investigation by Ronan Farrow in the New Yorker Monday revealed that Boies’ firm Boies Schiller Flexner was contracting with private intelligence firms to intimidate and discredit actresses who had made allegations against Weinstein. One of the contracts reportedly bears Boies’ own signature. The law firm in total has given more than $182,000 to Vance’s campaign since 2009.

In response to mounting criticism, Vance announced he would suspend all further fundraising and enlisted the Center for the Advancement of Public Integrity to undertake a review of his campaign finance practices. However, as IBT reported Tuesday, the center is bankrolled by one of the private investigation firms that Weinstein hired.

The controversy also prompted New York Assemblyman Dan Quart to introduce legislation that would limit how much defense attorneys can contribute to the campaigns of district attorneys.

By the time the questions about Vance’s conduct erupted, the deadline for candidates to register had long passed and Vance was running unopposed. Marc Fliedner entered the race, enlisted largely by outrage on social media at Vance’s growing scandals. Fliedner’s communications director described the campaign to IBT on Election Day morning as “scrappy” and powered almost entirely by volunteers without a professional staff to match the incumbent’s.

“We are currently at 14,000 votes in the 10 percent range,” Fliedner told IBT Tuesday after New York polls closed. “We are so psyched that a write-in campaign can accomplish that. This is a message from the voters. They want accountability. They want equal justice. They want change.”

Even as Vance celebrated his win, he acknowledged a need for reform in district attorney’s races.

“We will continue to innovate in all that we do, including making sensible changes in political fundraising, because campaign finance reform is criminal justice reform,” he said.