RICHMOND — Facing the prospect of further downgrade from credit rating agencies, the city has passed a balanced budget, but not before eliminating at least seven vacant positions, laying off four people and reducing spending on libraries, community centers and a violence prevention program.

The $151.9 million budget was unanimously approved last month after lengthy discussions about how to best trim the approximately $12 million deficit.

Last year, Moody’s Investors downgraded Richmond’s rating to junk status, citing high debt obligations, growing expenses and reliance on one-time revenues. The state controller’s office has also recently investigated the city’s use of its gas tax fund and state and federal funds, findings that are expected to be made public later this month.

In December, an outside consultant hired by the city found that Richmond’s deficit would balloon to $23 million by 2021 unless it immediately addressed spending, including higher-than-average expenditures on law enforcement and high compensation costs, which together total an estimated 77 percent of the budget.

The cuts in the 2016-17 budget include:

Laying off four people in public works;

Eliminating the currently vacant fire marshal position;

Eliminating five vacant police positions and reducing overtime;

New contributions to medical and other benefits for firefighters;

Elimination of neighborhood cleanups;

Reduced assistance to the Office of Neighborhood Safety, an outreach program that seeks to divert the city’s most violent offenders;

A $20,000 cut for books and other library materials;

Eduction of part-time staffing in community services, resulting in shorter hours at local community centers and less program staff.

Members of the Richmond Progressive Alliance, which hold three seats on the seven-member council, had initially opposed the deep cuts to social services, arguing that the city reductions would have the greatest consequence for Richmond’s poorest residents. Instead they proposed graduated cuts to the highest paid personnel, including a 1 percent reduction for people earning between $60,000 and $80,000, a 2 percent reduction for those earning $80,000 to $90,000 and another 2 percent for each additional $10,000.

“City officials may believe they are looking out for residents by cutting city services to provide a balanced budget, but this ends up balancing the budget on the backs of our community at large, and that is not a just and equitable way to proceed, especially in a community that has such a large low-income population,” wrote Councilwoman Gayle McLaughlin in an email. “This pathway of cutting city services, and potentially laying off city staff, will not bring us closer to a just and equitable Richmond.”

But the RPA alternative was not popular with city employees, who on average earn $92,229 a year, according to a recent analysis by the state controller, the fifth highest average in the state. The report is online at publicpay.ca.gov.

The RPA agreed to approve the budget as long as the topic of graduated salary cuts could be revisited in the near future.

Karina Ioffee covers the city of Richmond and West Contra Costa County. She has been a reporter for 15 years and has won numerous awards for her work, including from the Overseas Press Club. She speaks Spanish and Russian and is a former competitive gymnast. When not working, she likes to do yoga, cycle and dance.

Otto Warmbier was arrested in January 2016 at the end of a brief tourist visit to North Korea. He had been medically evacuated and was being treated at the University of Cincinnati Medical Center when he died at age 22.