Conservative author and filmmaker Dinesh D’Souza has been sentenced to spend the next eight months in a community confinement center in San Diego, but one of President Barack Obama’s harshest critics is still smiling after he avoided jail time in a federal campaign finance law case. D’Souza was also ordered to perform community service by teaching English to new immigrants.

D’Souza, a 53-year-old San Diego resident, celebrated the sentence during an interview with Fox News’ Megyn Kelly Tuesday. “I’ve got a big smile on my face now, and I think I’ve had it for several hours. I can’t wipe it off because this was really an effort to put me out of business,” the “2016: Obama’s America” filmmaker said of the prosecution against him. “The government was trying to lock me up for between 10 and 16 months, and a federal judge said no.”

D’Souza pleaded guilty to violating federal campaign finance law stemming from contributions made to Wendy Long, the 2012 GOP candidate for governor in New York. D’Souza used his mistress and an assistant as so-called “straw donors,” who made contributions to Long’s campaign and were then reimbursed by D’Souza so that the conservative pundit could get around maximum contribution limits.

Federal prosecutors sought up to a 16-month prison sentence for D’Souza. While U.S. District Court Judge Richard M. Berman disagreed with D’Souza’s contention that he was the victim of selective prosecution, the judge didn’t think D’Souza deserved prison time.

“My faith in an independent judiciary is affirmed,” D’Souza told Kelly. “My own country tried to get me and put me away, and the court said no. There was just an all-out attempt to put me away.”

D’Souza said his sentence -- eight months in a community confinement center, five months’ probation and a $30,000 fine -- means that he can continue his work.

“If I was locked up, I would not have been able to make a film in the election year 2016,” he said. “Now I can do my work, I can continue to write books, I can continue to function.”

D’Souza said he was unsure what life would be like for eight months in the community confinement center, which is similar to a halfway house. But he said he’ll use his time to persuade others in the center to become conservatives.

“Believe me, they’re all going to be Republicans by the end of it,” he said.