More than a year after "The Real Housewives of New Jersey" premiered on Bravo in 2009, the state Attorney General’s Office announced it had entered into a multimillion-dollar settlement with Wells Fargo stemming from allegations of fraudulent mortgage sales practices.

That 2010 bank settlement is now at the center of an immigration appeal by Joe Giudice, the husband of Teresa Giudice, one of the stars of the popular show. Joe Giudice is facing deportation to Italy after he recently completed a 41-month prison term for bankruptcy and mortgage fraud charges.

In October, a judge ordered that Giudice be deported upon release, but his lawyers filed an appeal the next month.

In his appeal, one of Giudice's immigration attorneys, Jerard Gonzalez of Woodland Park, claims that Giudice was one of the estimated 900 New Jersey residents whom the bank settlement affected. He said that under the settlement, two of Guidice's home-related loans were forgiven.

More:Giudice considering contacting Trump to help with hubby's deportation case

More:Marty Caffrey talks Danielle Staub, pool scene and how show ruined marriage

More:RHONJ's Danielle Staub reportedly engaged — to a duke — week after divorce

More:Teresa Giudice vs. Jackie Goldschneider: Stalkers, ghostwriters, shoe stores

Gonzalez said Giudice was denied a cancellation of his deportation based solely on the "alleged loss to a bank for loans." Since the loans were forgiven, Gonzalez claims, Giudice’s offenses should not be considered an "aggravated felony,'' which under U.S. immigration law makes him deportable.

“The loans in question were written off,’’ Gonzalez said. "The loans that were on the properties that he was convicted of committing fraud on, there was no loss. ... they had no choice on that; the banks wrote them off."

He said that as part of a plea deal on the federal charges, Giudice paid more than $400,000 in restitution to the bank.

"I don't even think the bank was even entitled to it, but it was mandatory,'' Gonzalez said. "To me, maybe that money should have been given to the attorney general, not to the bank."

Giudice was scheduled to be released from prison in March after completing his federal sentence. But because his immigration case is pending, he was transferred to an immigration detention center at the Clinton County Correctional Facility in Pennsylvania, where he remains.

Giudice was born in Italy and moved to the United States with his parents when he was a year old. He was raised in the United States and allowed to live and work here legally because he had a green card, or permanent legal residency.

Texting-while-driving crackdown:Here are the 207 NJ police departments participating

Best April Fool's jokes 2019:Have you been tricked by these North Jersey pranks?

Coming soon:American Dream plans to open by late summer

He could have applied to become a U.S. citizen, but he never did, his attorney said.

Green card holders, or those with legal residency, can be deported by the U.S. government if they commit a crime.

In 2013, Giudice and his wife were charged with conspiracy to commit mail and wire fraud, bank fraud, making false statements on loan applications and bankruptcy fraud. Prosecutors at the time alleged that they overstated their income when applying for loans, then concealed the wealth they earned from the television show in a bankruptcy filing. The indictment said they obtained millions in home-related loans between 2001 and 2008.

The couple pleaded guilty in federal court in March 2014 to defrauding lenders of more than $5 million by submitting phony documents to get construction and bank loans, and by withholding assets and lying to bankruptcy officials. Joe Giudice also admitted that he failed to file a 2004 tax return.

Story continues below gallery

In 2015, while he was waiting to serve his federal sentence, Giudice was sentenced by a judge in Paterson to 18 months in state prison for using his brother's birth certificate to obtain a driver's license. He was allowed to serve the time concurrently with his sentence on the federal financial fraud conviction.

The settlement reached between the New Jersey Attorney General’s Office and Wells Fargo in 2010 was announced years before Giudice’s arrest. In it, Wells Fargo agreed to provide consumers in the Garden State with $67 million in loan modifications, including forgiveness of accrued interest and late fees for borrowers, as well as principal reductions, principal forgiveness and interest rate reductions.

Wells Fargo also agreed to pay the state $3.98 million to resolve allegations that the companies it acquired, including Wachovia Corp., deceptively marketed adjustable-rate mortgage loans, the Attorney General’s Office said. Giudice had received the loans in question from Wachovia, Gonzalez said.

Gonzalez said he is not sure when a decision on the immigration appeal will be handed down.

"They are supposed to expedite detained cases, but it's been a year since we started,'' Gonzalez said, noting that Giudice was placed in removal proceedings last year while serving his federal sentence.