Former Maryland congressional candidate Wendy W. Rosen pleaded guilty Friday to voting illegallyin two elections and will serve five years probation and pay a $5,000 fine.

The 58-year-oldRosen, who won a Democratic primary last year to challenge Republican Rep. Andy Harris in Maryland’s 1st Congressional District, cast ballots in 2006 and 2010 in Baltimore County even though her legal residence was in Florida. The revelation last Septembeended her run.

The sentence is the result of a plea agreement with the Maryland State Prosector's Office. Rosen will also serve 500 hours of community service.

Rosen apologized to campaign supporters Friday, but also said she hoped the incident would shine a light on what she described as more serious examples of voter fraud. She argued that some states take great efforts to keep the poor and minorities from voting, for instance.

“What I did wasn't right, it wasn't smart, but it was [an act] of civil disobedience, not arrogance, and if it somehow ... helps to bring this problem to light, it will be worth the pain I've endured over these last six months and into the future,” Rosen said in a statement.

Rosen, who runs a Baltimore publishing business, had a tough fight for the Democratic nomination last April but beat Chestertown physician John LaFerla by 57 votes in the primary.

The controversy — brought to light by state Democratic leaders two months before the Nov. 6 general election — forced Rosen to withdraw from the race.

With Rosen out, party leaders endorsed the return of LaFerla as a write-in candidate. But Rosen’s name remained on the ballot, and she received more than 92,800 votes, about 28 percent of the total and far more than LaFerla.

Harris, meanwhile, coasted to reelection in November with more than 63 percent of the vote.

Rosen told The Baltimore Sun in September that she was eligible to register to vote in the St. Petersburg, Fla., area because she owned property there. She said she did so to help a friend who was running for City Council.

Maryland and Florida held gubernatorial and congressional contests in 2006 and 2010.

“The Office of the State Prosecutor will continue to aggressively investigate and prosecute those who threaten the integrity of our elections by voting unlawfully,” State Prosecutor Emmet C. Davitt said in a statement.

Rosen had publicly criticized media coverage of the charges against her, which were detailed in a press release issued by prosecutors in December.

She said she had reached a plea agreement before the release was issued, which is true. But the deal was not entered in Baltimore County Circuit Court until Friday.