President Donald Trump said Thursday he's considering commuting the sentence of former Illinois Gov. Rod Blagojevich, who was convicted of corruption, and pardoning lifestyle entrepreneur Martha Stewart, who served a stint in federal prison after being convicted of charges related to a stock sale.

Hours earlier, Trump said on Twitter that he will pardon conservative commentator and Obama critic Dinesh D'Souza, who pleaded guilty to campaign finance fraud. The White House announced later Thursday that the pardon had been granted.

As he left Washington to fly to Texas, Trump tweeted: "Will be giving a Full Pardon to Dinesh D'Souza today. He was treated very unfairly by our government!" D'Souza, an outspoken critic of former President Barack Obama, had claimed that his prosecution by the Obama Justice Department was politically motivated, but the presiding federal judge said D'Souza had failed to prove it.

Trump later shared his thoughts on Blagojevich and Stewart with the reporters accompanying him on Air Force One. Both had connections to Trump's "Celebrity Apprentice" reality television show: Blagojevich was a contestant in 2010 and Stewart hosted the 2005 spinoff series, "The Apprentice: Martha Stewart."

Blagojevich was convicted on numerous counts of corruption, including for trying to sell the U.S. Senate seat that was vacated by Obama and for shaking down a children's hospital. As governor, he had the right to name someone to fill the Senate vacancy, but he was caught on FBI wiretaps discussing ways to make money off of it. He began serving a 14-year prison sentence in 2012 and is scheduled for release in 2024.

"What he did does not justify 18 years in jail," Trump said. "If you read his statement, it was a foolish statement with a lot of bravado. Plenty of other politicians have said a lot worse. He's a Democrat, he's not in my party, but I thought he got treated unfairly."

The Supreme Court has twice turned down appeals from Blagojevich, most recently in April. That appeal turned in part on the length of Blagojevich's prison term. Trump's Justice Department urged the court to reject the appeal.

Patti Blagojevich, the former governor's wife, said she and the couple's two children were "very encouraged" by Trump's comments. "He's given us something that has been hard to come by recently. Hope," she said in a written statement.

In a statement Thursday, Blagojevich's wife, Patti Blagojevich, said:

“Amy, Annie and I are very encouraged by the President’s [sic] comments today. He’s given us something that has been hard to come by recently… hope. From the beginning, we’ve eagerly awaited the day when Rod could come back home where he belongs, and we continue to pray our family will be made whole again soon.”

Stewart was convicted in 2004 of obstructing justice and lying to the government about why she unloaded stock just before the price plummeted. She served five months in prison. Her representatives did not immediately respond to a request for comment.

"I think to a certain extent Martha Stewart was harshly and unfairly treated. She used to be my biggest fan in the world," Trump said.

The federal prosecutor who oversaw Stewart's case in New York was James Comey, one of Trump's principal antagonists and the man he fired as FBI director last year. The prosecutor who led the case against Blagojevich in Chicago was Patrick Fitzgerald, a Comey friend who is also his lawyer. Fitzgerald was also the special counsel leading the case against I. Lewis "Scooter" Libby, the Bush administration official pardoned by Trump last month.

Trump told reporters Thursday that no one asked him to pardon D'Souza, whose case had become a cause in conservative circles. Trump said he only knew D'Souza from TV and reading his works. He said he telephoned D'Souza on Wednesday night.

"I've always felt he was very unfairly treated," he said, adding that D'Souza should have just been given a "quick, minor fine. What they did to him was horrible."

D'Souza thanked those who urged Trump to pardon him, and took a swipe at Preet Bharara, the U.S. attorney who prosecuted him.

"My heartfelt thanks to those who prayed for me, supported me & reached out on social media to President Trump to pardon me," D'Souza tweeted. In a separate tweet, titled "KARMA IS A B---- DEPT:" D'Souza accused Bharara of being out to "destroy a fellow Indian American to advance his career. Then he got fired & I got pardoned." Trump fired Bharara from the U.S. attorney job after initially promising Bharara that he would stay on in the new administration.

In response, Bharara acknowledged Trump's right to issue pardons but said "D'Souza intentionally broke the law, voluntarily pled guilty, apologized for his conduct & the judge found no unfairness. The career prosecutors and agents did their job. Period."

D'Souza, a filmmaker, author and speaker, was sentenced in September 2014 to five years of probation after he admitted making illegal contributions to a U.S. Senate candidate in New York. He acknowledged he had two close associates each contribute $10,000 to the Senate campaign of Republican Wendy Long with the understanding that he would reimburse them. Individual contributions to any one candidate were limited to $5,000 at the time. Long lost to Democratic Sen. Kirsten Gillibrand.

Watchdog groups criticized D'Souza's pardon, saying it signaled the president's contempt for the rule of law.

"Donald Trump has sent a message to his friends and cronies that if you break laws to protect him or attack our democracy, he's got your back," said David Donnelly, president and CEO of Every Voice. "Contribution limits are a key bulwark against corruption in politics and pardoning the man who knowingly violated them is in direct conflict with his pledge to drain the swamp in Washington."

Other government watchdogs raised Trump's first pardon, issued last August to former Arizona sheriff Joe Arpaio. Arpaio was awaiting sentencing after he was convicted of criminal contempt of court for disobeying a federal judge's order to stop immigration patrols that focused on Latinos.

D'Souza, who made the documentary "2016: Obama's America," had claimed he was selectively prosecuted, but the judge said he had produced no evidence of this.

D'Souza is a former policy analyst under President Ronald Reagan and a prolific author well-known for works critical of Obama, as well as Hillary Clinton, Trump's Democratic rival in the 2016 presidential election. His 2016 documentary, "Hillary's America: The Secret History of the Democratic Party," attempts a takedown of the former Obama secretary of state.

In February, D'Souza apologized for mocking Parkland, Florida, high school students who were upset after the Florida House voted down a proposed ban on a type of semi-automatic rifles known as assault weapons. The students had lost 17 classmates and teachers in a shooting that month.

D'Souza said in one tweet that the students had received the "worst news since their parents told them to get summer jobs." In another tweet, he wrote "Adults 1, kids 0."

The tweets have been sharply criticized by some Florida Republicans, including Gov. Rick Scott. Despite the backlash, D'Souza is scheduled to speak at a two-day event next month sponsored by the Republican Party of Florida. Scott, who is running for U.S. Senate, has not yet said if he will attend.

Patti Blagojevich appeals to Trump to help her husband

Patti Blagojevich made an emotional appeal to President Donald Trump to help her husband on Thursday, saying in an interview on Fox News that the President is "compassionate" and "knows how important it is that my husband gets home to be a father to our daughters."

She said on Fox News that her husband and the rest of their family "are all so grateful that the President is thinking of us."

She added that "we know that President Trump is a kind man, he's compassionate, he has always been kind to my family. He knows how important it is that my husband gets home to be a father to our daughters, that we can't help but to be hopeful."

In making her appeal, Blagojevich's wife also suggested that there are similarities between her husband and the President.

"The same people that did this to my family ... these same people are trying to do the same thing that they did to my husband, just on a much larger scale," she said. "They were emboldened. They took down a governor and now they've got their sights much higher."

It was not immediately clear who she was referring to, though CNN has previously reported that Blagojevich's conviction has ties to former FBI Director James Comey, who the President abruptly fired last year.