SANTA FE, N.M. — A legal battle focused on the plight of New Mexico’s most vulnerable public school students is heading to a state district court judge this week after two months of testimony in a case that may reshape the way public schools are funded and guided by the state.

Parents, local school districts and advocacy groups sued the state of New Mexico for failing to meet constitutional obligations to provide essential educational opportunities to all students and for not following through with 2003 reforms designed to better engage Native American students.

After two months of testimony, the judge may reshape the way public schools are funded and guided by the state. Testimony is scheduled to end Friday.

The outcome could reshape funding and education policies for English-language learners, Native American youth and students from low-income families across a state with the highest second highest poverty rate in the U.S.

New Mexico’s classrooms serve the highest percentage of Hispanic students in the country and the second-highest percentage of Native American students after Alaska — providing a testing ground for cultural enrichment programs and bilingual instruction involving Spanish and several Native American languages.

“The constitutional deficiencies arise from a lack of monitoring, a lack of accountability and a lack of sufficient resources for at-risk students,” said Marisa Bono, southwest regional counsel the Mexican American Legal Defense and Educational Fund, a group in the coalition of plaintiffs. “All we’re looking for is the court to declare that the system is unconstitutional, and an injunction for some reasonable period of time until the Legislature and the Public Education Department bring the system into compliance.”

Education officials under Republican Gov. Susana Martinez have defended state spending on classrooms as more than adequate and say an array of new programs help struggling students and hold teachers accountable.

In court filings, they have said lagging New Mexico public school student performance correlates with factors beyond the control of schools — entrenched poverty and a high percentage of students who begin school without strong English skills.

New Mexico is one of several states where courts are being called upon to shore up funding for public schools, as frustration mounts with elected officials over state budget priorities and the quality of education.

In Washington state and Kansas, lawmakers are struggling to satisfy state supreme court orders to provide more money for basic education. In Arizona, a group of school districts and education associations sued the state in May, saying the Legislature has short-changed them by billions of dollars in infrastructure spending over the past decade.

A 1973 U.S. Supreme Court decision opened the way for a series of school funding lawsuits under common state constitutional provisions aimed at ensuring adequate public school education, said Molly Hunter of the New Jersey-based Education Law Center, a nonprofit advocacy group on school funding issues.

“You’re not necessarily looking for the Cadillac of education, but they’re setting the floor, they’re looking for adequate funding for all kids,” Hunter said.

Attorneys for the state of New Mexico called a final expert witness Thursday in an attempt to discredit a 2008 study that recommended a $335 million annual increase in support for the state’s public schools to meet adequate education standards.

New Mexico dedicates about 44 percent of annual general fund spending to public school education, and members of a Democrat-led Legislature have been bracing for a court ruling that could require more. Martinez, who leaves office in 2018, staunchly opposes tax increases.

“You’re devastating the rest of government,” warned Sen. John Arthur Smith, a Democrat who leads the state’s senate finance committee.

The school funding case merges two lawsuits brought against the state on behalf of parents of public school students and seven school districts. They are represented by attorneys with the New Mexico Center on Law and Poverty and the Mexican American Legal Defense and Educational Fund.

A decision from District Court Judge Sarah Singleton could still be months away. Attorneys on both sides of the lawsuit say they are likely to appeal any adverse outcome.

In North Carolina, the state and attorneys for school districts in poor communities have been locked in litigation since a 1994 ruling said state constitutional provisions guarantee every child an opportunity to “a sound basic education.” An independent consultant was assigned in July to find a resolution.