Boston-area Rabbi Barry Starr allegedly paid nearly half a million dollars — taken from synagogue funds and borrowed from his congregants — to hide his affair with a 16-year-old male.

According to statements released Monday in the Stoughton District Court, Starr, the longtime spiritual leader at Temple Israel of Sharon before his recent resignation, used $480,000 to pay a man who claimed to be the teen’s brother. Nicholas Zemeitus, 29, threatened to expose the affair, which occurred two years ago, unless Starr paid him.

Much of the money came from the the rabbi’s discretionary fund. The Boston Globe reported that Starr also asked congregants for loans of tens of thousands of dollars to cover up the affair. Congregants are now suing him to recover the funds.

Starr could be charged with larceny by false pretense, forgery and forging a document, Sharon Police Detective Scott Leonard wrote in a statement to the court. The age of consent in Massachusetts is 16, so the affair itself does not constitute a crime.

Leonard wrote that Starr altered denominations on some of the eight checks he gave Zemeitus last month. In one instance, Leonard wrote, Starr added two zeroes to an $18 check.

“Sometimes people who try to be good people do things that are wrong, hurtful, and shameful,” Starr wrote in a letter to congregants last month, according to the Globe.