Detroit Federation of Teachers interim president Ivy Bailey addresses teachers outside the school district’s headquarters on May 3 in Detroit. (Carlos Osorio/AP)

The teacher sickouts that closed most city schools for two days this week capped a chaotic year in one of the nation’s most dysfunctional school systems, where buildings are crumbling, debt is diverting money from classrooms and the vast majority of students are not proficient in math and reading.

Detroit’s public schools were able to reopen Wednesday after officials promised that teachers will be fully paid for their work, even though the system expects to run out of cash next month. But as tens of thousands of children streamed back to their classrooms, it was not clear where the money would come from to fulfill that pledge — nor how the school system’s deeper problems might be resolved.

The financial and academic challenges here are similar to those in other urban systems that serve large numbers of poor children, such as Philadelphia, Chicago and Newark. Those districts all have struggled with declining enrollment, tight resources and rising debt at the same time they are facing growing competition from charter schools.

In addition, 31 states are spending less per pupil on education now than they were before the Great Recession, according to the nonprofit Center on Budget and Policy Priorities. Many school districts, in cities and elsewhere, still have not fully recovered from the austerity measures put in place after the housing collapse.

In Philadelphia, for example, officials had to take out a $550 million loan this winter to stay open amid a state budget impasse. In Chicago, a budget crisis forced midyear layoffs and cuts. Union leaders, who already have held an unprecedented one-day walkout to press for more state education funding, are now considering a strike.

Detroit’s history makes it a singular city, and the crisis in public education is extreme.

But “all of these cities are dealing with different pieces of this. It’s just that Detroit has everything happening at one time, and all of those things are amplified because of Detroit’s particular circumstances,” said Andy Smarick of Bellwether Education Partners, a consulting firm. “It is showing us where other cities are going to end up unless they get really smart about managing this transition.”

Detroit’s economic collapse in recent decades fueled dramatic population loss and equally dramatic enrollment declines in the public school system, from close to 300,000 students in 1966 to about 46,000 today.

The city’s growing corps of charter schools has contributed to the enrollment decline, siphoning off not just students but also tax dollars. More than half of Detroit students now attend charters.

Smarick said that Detroit has tried to stem the school system’s financial losses but has failed to grapple with these fundamental shifts. Detroit’s per-pupil funding is not extremely low, he argued — federal data shows that the city spent more than $14,000 per student in 2013, more than the average in Texas or Florida.

But the math won’t work until the city adjusts to the reality that the school system no longer has a monopoly in public education.

Others describe the fundamental problem in Detroit differently.

Michael Casserly of the Council of the Great City Schools, a coalition of 70 urban school systems including Detroit, said that leaders of Detroit’s school system over the years have been so consumed by dealing with financial problems and mismanagement that there has been little attention paid to educating children.

Malfeasance has been a common problem in Detroit; in March, 13 current and former school administrators were charged with conspiracy to commit bribery for allegedly taking kickbacks in return for steering contracts worth $2.7 million to a businessman.

“Detroit’s a unique case. I’ve never seen anything quite like it,” Casserly said. Other urban school systems have been able to make some academic progress despite the challenges they face, he said. Detroit has not.

Only 5 percent of fourth-graders were proficient in math on 2015 national tests, and 6 percent were proficient in reading.

Union leaders and teachers say that cities made a mistake when they bet heavily on charter schools as a solution rather than providing adequate funding for school systems tasked with serving all children.

“You see this loop of starving the schools rather than investing in them,” said Randi Weingarten, president of the American Federation of Teachers, the nation’s second-largest teachers union.

Rebecca Sibilia, executive director of the nonprofit EdBuild, which studies school funding nationwide, said that Detroit’s woes are rooted at least partly in public policies that have led to extreme socioeconomic segregation.

The poverty rate in Detroit is 49 percent, compared with 7 percent in the neighboring suburb of Grosse Pointe — the biggest difference in the nation, according to EdBuild’s analysis.

That school district boundary allows Grosse Pointe to tax itself at a far lower rate for its schools, Sibilia said. Meanwhile, the state fails to recognize the greater need among children in Detroit and dedicates roughly the same amount to education in Grosse Pointe, she said, citing census data.

“State funding for schools has always been intended to make up for inequities between the rich and poor, not to create a system where the wealthy benefit,” Sibilia said.

Wherever the blame lies, it’s clear that the schools are deeply broken. Students are going to class in rodent-infested rooms with crumbling walls and faulty heating and cooling systems.

Teachers, who drew national attention to those deplorable conditions with multiple sickouts earlier this school year, have seen their wages frozen and cut over the past decade.

The instability is driving some veterans away.

As students streamed through the doors of Louis Pasteur Elementary in northwest Detroit on Wednesday morning, kindergarten teacher Jennifer Jackson said she was happy to be back at work.

But she said she is planning to retire this summer after 27 years in the classroom: “I love teaching, but I’m a little tired of fighting.”

This week’s two-day sickout was meant to protest the possibility that the ailing district would not be able to pay teachers their full salaries. The sickout ended Tuesday when Steven Rhodes, the state-appointed emergency manager, promised that teachers would indeed be paid.

Many parents and caregivers dropping children off at Pasteur Elementary said they supported the teachers’ protest, despite the inconvenience it caused. “They support the children . . . and they don’t get paid enough,” said Sherrille Bryant-Carter, whose three grandchildren and niece attend public schools.

Yana Mote, the mother of a fourth-grader, said she understands why the teachers needed to act. But she wishes the sickout had not taken place only six weeks before school ends. “It’s a critical time,” Mote said.

Michigan lawmakers are in the midst of debating what they can do to address Detroit’s long-standing problems. The clock is ticking: The school system is expected to run out of cash on June 30.

Elmer reported from Detroit.