Former Democratic presidential candidate John Edwards pleaded not guilty to charges of soliciting and spending nearly $1 million in campaign funds to cover up an extramarital affair and out-of-wedlock baby during his 2008 bid for the White House.

Edwards was indicted on six counts -- including conspiracy, four counts of illegal campaign contributions and one count of false statements -- by a grand jury in the state of North Carolina on Friday.

Edwards told reporters outside the courthouse Friday afternoon that he has done wrong but did not break the law.

According to the indictment, the former North Carolina senator spent more than $925,000 to keep his relationship with campaign worker Rielle Hunter from hampering his bid for the Democratic presidential nomination in 2008.

Edwards and Hunter began their relationship in early 2006, as the 57-year-old Democrat was plotting his second run for the White House. At the time, Hunter's video production company was paid $100,000 to produce a series of short videos offering a behind-the-scenes glimpse at Edwards' life.

The pair are believed to have ended their relationship in mid-2008, around the same time his campaign ended.

Soon after revealing his relationship to the public, Edwards and his wife split. But he continued to carry the secret of his and Hunter's daughter until 2010.

"Edwards knew that public revelation of the affair and the pregnancy would destroy his candidacy by, among other things, undermining Edwards' presentation of himself as a family man and by forcing his campaign to divert personnel and resources away from other campaign activities to respond to criticism and media scrutiny regarding the affair and pregnancy," the indictment said.

Edwards said he will regret the harm he has caused for the rest of his life.

Specifically, the indictment points to private donations from two wealthy supporters -- $200,000 from his former campaign finance chairman Fred Baron and $725,000 from 100-year-old widowed banking fortune heir Rachel Mellon -- alleging that money was used to pay for Hunter's living and medical expenses as well as chartered airfares, luxury hotels and rental for a house in Santa Barbara, Calif. All of those measures were intended to keep her out of the public eye, the indictment added.

In the U.S. at that time, individual contributions to candidates were capped at $2,300.

Former Edwards campaign staffer Andrew Young initially claimed paternity of Hunter's child, enabling his boss to mount his campaign. Young has since become estranged from his former boss, going so far as to write a memoir detailing the breadth of the costly coverup. His grand jury testimony – which included allegations Edwards not only agreed to solicit money directly from Mellon, but knew that it would be spent to keep Hunter secluded -- is considered crucial to the case.

Investigators have been probing Edwards' background for more than two years.

His wife Elizabeth was first informed of the affair in 2006, but nevertheless went on to play a crucial role in the 2008 campaign. She died of breast cancer in December, 2010.

Edwards is due to appear in a Winston Salem, North Carolina court on Friday afternoon. He does not have to post bond but he had to surrender his passport and is not allowed to leave the continental U.S.

If convicted, he could face up to five years in prison.

With files from The Associated Press