(Reuters) - Conservative author and filmmaker Dinesh D'Souza was sentenced on Tuesday to spend eight months in a community confinement center during five years of probation after pleading guilty to a campaign finance law violation.

The defendant, a frequent critic of President Barack Obama, was sentenced by U.S. District Judge Richard Berman in Manhattan. He was also given a $30,000 fine and ordered to do one day of community service a week during his probation.

D'Souza, 53, admitted in May to illegally reimbursing two 'straw donors' who donated $10,000 each to the unsuccessful 2012 U.S. Senate campaign in New York of Wendy Long, a Republican he had known since attending Dartmouth College in the early 1980s.

"It was a crazy idea, it was a bad idea," D'Souza told Berman before being sentenced. "I regret breaking the law."

Prosecutors had sought a 10-to 16-month prison sentence, rejecting defense arguments that D'Souza was "ashamed and contrite" about his crime and deserved probation with community service.

(Reporting by Nate Raymond in New York; Editing by James Dalgleish)