A former Montgomery County official who stole more than $6.7 million from the county was led from a Rockville courtroom in handcuffs Thursday, after a judge sentenced him to serve a total of 15 years in prison — beginning immediately.

Byung Il “Peter” Bang will serve the first four years of his state sentence concurrent with his federal sentence for charges related to the theft scheme, handed down last month in U.S. District Court in Greenbelt.

Before imposing her sentence, Montgomery County Circuit Court Judge Cheryl McCally noted the deliberate actions Bang took in setting up the years-long embezzlement, and she pointed out that Bang never took action to stop the crime.

“I wonder, part of this had to be the thrill — am I going to get away with it?” McCally said. “To hear this told, it’s almost like a movie Leonardo DiCaprio should be in.”

Bang pleaded guilty in November to the state counts and to federal charges of wire fraud and fraud and false statements. He admitted to diverting county funds to a shell company he created in 2010 while he was chief operating officer of Montgomery County’s now-defunct Department of Economic Development.

The theft lasted until 2016, when the county privatized its economic development department and moved Bang to the finance department.

By that point, court records show, Bang had stolen more than $6.7 million from the county — the largest theft of public funds in the suburban Maryland county’s history. Prosecutors said Bang used the money for his own benefit, gambling at casinos around the country.

The scheme was discovered by the Internal Revenue Service, which began looking into large cashier’s checks that Bang brought to the casinos.

In court Thursday, Montgomery County Assistant State’s Attorney Bryan Roslund showed copies of some of those checks — including one for $55,000, made out to the ARIA Resort & Casino in Las Vegas.

He noted Bang didn’t gamble away all the money, spending $10,000 for a membership to the Blue Mash Golf Course in Montgomery County and putting $14,000 in clothing purchases on his debit card while paying his mortgage and credit card bills on time.

“It’s hard to comprehend how much money that is,” Roslund said, speaking of the millions Bang took from the county. “And it just went to his pocket. It just went to his games and entertainment.”

As part of his plea deal, Bang agreed to pay the county back, even though prosecutors have said the money appears to be gone and that the county is unlikely to ever be paid back fully.

County officials expect to receive the contents of Bang’s retirement account — roughly $1 million — plus an additional $137,925 from the sale of one of Bang’s two homes.

Montgomery County State’s Attorney John McCarthy’s office had requested a sentence of at least 12 years of prison time. But Bang’s attorney, Gerald W. Kelly Jr., of Columbia, Md., told McCally that while Bang’s crimes were “serious,” his client suffered from a gambling addiction and mental-health issues stemming from a “horrific” childhood.

He also urged McCally to consider that the sentencing guidelines for the charges called for probation to up to two years in prison.

“He sincerely regrets the financial and intangible harm he caused the county,” Kelly said, adding that Bang immediately pleaded guilty to the crimes after being discovered, sought counseling and wants to pay the county back.

McCally also heard pleas for leniency from Bang’s former pastor and his wife, Youn Jung, who spoke of her husband’s devotion to her as she battled a serious illness for the past 10 years. And she heard from Bang himself.

“I betrayed a high level of trust placed in me by Montgomery County,” Bang said, reading from a prepared statement. He said he relied on gambling “to numb emotional pain and escape reality.”

But McCally said that while she rarely exceeds the state sentencing guidelines, this would be one of those times.

“This case comes down to greed,” she said. “It also comes down to the irreparable harm that has been caused to this community.”

McCally sentenced Bang to 20 years for a theft scheme over $100,000, and another 20 years for a second charge, misconduct in office. She suspended 10 years of the first sentence and 15 years of the second and ordered them served consecutively.

While the federal judge who heard Bang’s case had said he could surrender to prison next month to begin serving that sentence, McCally on Thursday ordered Bang to go straight into custody.

Sheriff’s deputies placed Bang in handcuffs and led him from the courtroom as his wife broke into tears.

After court, Kelly declined to comment on the length of the sentence, saying that the legal team was still evaluating its options, but called McCally’s decision to immediately imprison Bang “unnecessary.”

McCarthy lauded the sentence.

“In this case, Mr. Bang’s victims were not just Montgomery County, but basically everyone who lives here,” he said.