Democratic presidential candidate Bernie Sanders sued the Democratic National Committee in federal court on Friday to regain access to crucial voter files and accused party leaders of trying to undermine his White House bid and help rival Hillary Clinton.

The DNC had blocked access to the voter data after a Sanders campaign staffer improperly accessed Clinton's voter files, but the Sanders campaign said the breach was accidental and fired the staffer.

The lawsuit in U.S. District Court accused the DNC of improperly suspending the campaign's access to voter data and sought immediate restoration of the access.

RELATED: The Trump-Sanders debate you've been dying for is happening (almost)

The uproar in the campaign for the November 2016 election came one day before a debate between the presidential rivals, fueling rising tensions and longstanding complaints from Sandersand his liberal allies that the DNC is trying to help Clinton, particularly by limiting the number of debates and scheduling them on low-viewership periods like Saturday nights.

"In this case it looks like they are trying to help the Clinton campaign," Sanders campaign manager Jeff Weaver said at a news conference, accusing the DNC of taking the Sanderscampaign "hostage."

"We need our data, which has been stolen by the DNC. That's what we want back," Weaver said.

The Sanders campaign said the breach of the confidential files, which contain information such as past voting and donation history, was an isolated incident and blamed it on the DNC's software vendor, Washington-based NGP VAN, which the campaign said has dropped the firewall between the various Democratic candidates' data more than once.

But the Clinton campaign was informed the Sanders staff breached Clinton data in 25 searches by four different accounts, and the data was saved in Sanders campaign accounts, Clinton campaign spokesman Brian Fallon said.

RELATED: The Ernest Opinion: Can there be a liberal argument for guns?

"We are asking that the Sanders campaign and the DNC work expeditiously to ensure that our data is not in the Sanders campaign's account," Fallon said.

DNC Chair Debbie Wasserman Schultz defended the punishment against Sanders in a CNN interview, saying his campaign had acted in an "inappropriate, unacceptable" manner and had downloaded the information.

"To get to the bottom of it we are going to ask the Sanders campaign to participate in an independent audit," she said. "I hope they will agree to that."

The incident comes at a bad time for Sanders, the U.S. senator from Vermont who is trying to stop the heavily favored Clinton from running away with the party's 2016 presidential nomination.Sanders has been lagging behind Clinton, with 29 percent support to her 60 percent in recent Reuters/Ipsos polling.

Sanders, Clinton and a third candidate, former Maryland Governor Martin O'Malley, will debate at St. Anselm College in Manchester, New Hampshire, on Saturday night.

Stu Trevelyan, chief executive officer of DNC software vendor NGP VAN, acknowledged the breach in a statement but said his company is not aware of any previous reported incidents of data being "inappropriately available." He called the breach a "brief isolated issue" that was fixed and is now being reviewed.

RELATED: Sanders backs Clinton over email scandal, says time to move on

According to his LinkedIn account, Trevelyan is a former campaign and White House staffer for Hillary Clinton's husband, former President Bill Clinton.

Josh Uretsky, the Sanders campaign staffer fired for accessing the voter file, told MSNBC that his intent was to document and understand the scope of the problem so it could be reported.

"To my knowledge, we did not export any records or voter file data that were based on those scores,” he said.

Sanders supporters were outraged by the DNC's response to the breach.

"I think the DNC's crossed the line and it's going to open up a whole new part in the campaign season," said RoseAnn DeMoro, executive director of National Nurses United, a liberal group that endorsed Sanders. "I think this is a gloves-off moment."

Another liberal group, Democracy for America, rushed to Sanders' defense.

"The Democratic National Committee's decision to attack the campaign that figured out the problem, rather than go after the vendor that made the mistake, is profoundly damaging to the party's Democratic process," said Charles Chamberlain, Democracy for America's executive director.

He said DNC leaders "should immediately reverse this disturbing decision before the committee does even more to bring its neutrality in the race for president into question."