“I want to go back to society as a law-abiding citizen. I want to go back to my family,” he added.

Judge Forrest called Mr. Peralta “very eloquent” and acknowledged the group of relatives and friends in the courtroom supporting him. But in explaining her decision to impose a sentence on the upper end of the sentencing guidelines, Judge Forrest said she wanted to deter Mr. Peralta from future criminal activity.

“The moral compass that you had was not pointing due north,” she said.

After the sentencing, Mr. Peralta turned and waved at his family and friends. They waved back; one woman blew a kiss.

The initial investigation into Mr. Peralta, who was charged in April 2016, was relatively narrow; the authorities were suspicious of large sums of money flowing through a small Harlem liquor store owned by Mr. Peralta’s sister, who has not been charged with any wrongdoing. But the investigation gained attention for its overlap with subsequent inquiries into bribery among city law enforcement officials.

In particular, two of the investors in Mr. Peralta’s fictitious business, Jona S. Rechnitz and Jeremiah Reichberg, were said to have showered high-ranking police officers with jewelry, Brooklyn Nets tickets and hotel rooms in Rome and Chicago, in exchange for favors. The investigation into Mr. Peralta also led investigators to Norman Seabrook, the former leader of the city’s correction officers’ union, who investigators said took plane trips to the Dominican Republic paid for by Mr. Rechnitz. And both Mr. Rechnitz and Mr. Reichberg had raised money for Mayor Bill de Blasio’s campaign in 2013.

Three police commanders were arrested on federal corruption charges as a result of the bribery investigation, and Mr. Seabrook was indicted on a charge of honest services wire fraud and a charge of conspiracy to commit honest services wire fraud. A related inquiry into Mr. de Blasio’s fund-raising operation was closed in March. No charges were brought against the mayor or his aides.