The state of Texas is backing a school that expelled a black student after she refused to stand for the flag during the US Pledge of Allegiance.
Texas Attorney General Ken Paxton intervened on Tuesday to defend the Houston-area school district in its lawsuit with the student, India Landry.
Ms Landry, 18, filed a lawsuit after she was expelled last year from Windfern High School.
The case comes amid political tensions over respect for the American flag.
"School children cannot unilaterally refuse to participate in the pledge," Mr Paxton - the state's most senior law enforcement officer - said in a news release.
"The US Supreme Court has repeatedly held that parents have a fundamental interest in guiding the education and upbringing of their children, which is a critical aspect of liberty guaranteed by the Constitution."
The girl's lawsuit against Cypress Fairbanks Independent School District says her right to free speech and due process were violated when she was expelled on 2 October 2017.
Her lawyer said it is rare for the attorney general to intervene in a civil rights case.
"The reason he's challenging this case is that it's election time," attorney Randall Kallinen told the Houston Chronicle.
Last year, Ms Landry told reporters her opposition to the pledge was political, and that she was inspired by the NFL players kneeling for the US national anthem.
She said a school official told her: "This isn't the NFL."
Within days she sued, stating that administrators had been "whipped into a frenzy by the publicity of African-American National Football League players kneeling for the national anthem".
"I don't think the flag is for what it says it's for, liberty and justice and all that," she told KHOU-TV at the time. "It's not obviously what's going on in America today."
The lawsuit also accuses the principal, vice-principal, secretary and two teachers of treating her unfairly because she is black.
Mr Paxton submitted a court filing referring to a Texas state law that allows parents to submit a letter stating that their child will not stand for the pledge.
But he says standing is not optional for students who do not have parental permission.
"Requiring the pledge to be recited at the start of every school day has the laudable result of fostering respect for our flag and a patriotic love of our country," Mr Paxton said in the legal brief.
"This case is about providing for the saying of the Pledge of Allegiance while respecting the parental right to direct the education of children.
A 1943 Supreme Court case ruled that students cannot be required to stand for the pledge.
But several states have laws requiring parental permission for a student to boycott the pledge.
The girl's lawyer said he would be willing to argue the case before the Supreme Court.