A former attorney who operated a real estate practice in Needham has been sentenced to six years in prison for his role in a fraudulent mortgage scheme, according to the U.S. Attorney’s Office in Boston.

Marc D. Foley, 46, was also sentenced to 36 months of probation. In September, a jury convicted Foley of 33 counts of wire fraud and five counts of money laundering.

Prosecutors said that in December 2006 and January 2007, Foley participated in a scheme to defraud six mortgage lenders in connection with $4.9 million in real estate loans for the purchases of 24 condominium units in Dorchester. When Foley and an associate acting under his direction closed the loans, documents sent to the mortgage lenders falsely represented that funds ranging from $9,300 to $39,000 had been collected at the closings from the borrowers, which in fact the borrowers made no down payments and paid no funds at the closings.

Foley then entered into an undisclosed agreement with the seller to subtract from the seller’s proceeds all the funds that were reported to the lenders as coming from the borrowers. Foley also used various other means to conceal from the lenders that the borrowers had not provided funds for the purchases, prosecutors said.