The director of the California State Lottery resigned Friday, effective immediately, nearly a year after a letter to then-Gov. Jerry Brown accused the Lottery’s management team of public drunkenness and other unprofessional behavior during business trips.

That letter prompted an expanded audit of the Lottery, which uncovered a history of lavish spending – including $17,000 on pens shaped like baseball bats and $14,000 on baseball caps, the Sacramento Bee reported.

In addition, there have been complaints about unfair hiring practices, cronyism and nepotism at the agency, according to reports.

CALIFORNIA LOTTERY OFFICIALS SEEN IN BAWDY PHOTOS SENT TO GOVERNOR: REPORT

Hugo Lopez, who has led the Lottery since 2015, announced his departure in an email to his staff, according to the Bee.

In his own defense, Lopez mentioned in the email that the California Lottery’s revenue had grown to more than $7 billion annually from less than $3 billion a year a decade ago.

“At the national level, the California Lottery has been one of the fastest growing lotteries over the past few years,” Lopez wrote, according to the Bee.

Hugo Lopez, right, resigned Friday as director of the California State Lottery. He is shown congratulating prize winners on Jan. 14, 2016, in Chino Hills, Calif. (Getty Images)

Hugo Lopez, right, resigned Friday as director of the California State Lottery. He is shown congratulating prize winners on Jan. 14, 2016, in Chino Hills, Calif. (Getty Images)

But it was the anonymous letter to Brown – purportedly sent last summer by a Lottery employee – that drew the attention of lawmakers and investigators.

The letter reportedly included photos of bawdy behavior at a bar, including a man with his head inside a woman’s shirt, with most of the participants identified as being members of the Lottery’s management team.

“These types of unprofessional shenanigans have become a regular practice of this management team when they travel to meetings,” the letter read, according to the Bee.

The audit by the State Controller’s Office also revealed more than $300,000 in inappropriate spending on travel, food and hotel rooms over four years for sales conferences that typically exceeded their budgets, the Los Angeles Times reported.

In one case, a Lottery employee who lived just six miles from a meeting site was allowed to stay at a hotel for three nights, costing the agency $536, the report said.

“Our audit found that the Lottery lacked adequate controls, including policies and procedures,” the April audit report said, according to the L.A. Times.

“Our audit found that the Lottery lacked adequate controls, including policies and procedures.”

— California State Controller’s Office audit report

Lopez’s email announcing his departure did not mention any of the scandals or the audit, the Times reported. It was also unclear whether he was retiring or taking another state government job, the report said.

CLICK HERE TO GET THE FOX NEWS APP

But at least one Lottery staffer welcomed the news of Lopez’s departure.

“He’s one of the worst directors we have had,” Robert Medof, a Van Nuys-based Lottery sales rep and union shop steward, told the L.A. Times. “There is a lot of micromanaging. Sales might be high, but employee morale is incredibly low.”