*This story has been updated throughout.

A federal judge has ruled Texas will continue to need oversight of how it cares for vulnerable children, even after sweeping legislative changes last year.

In a 116-page opinion, U.S. District Judge Janis Jack ruled on Friday afternoon that Texas leaders will remain under the watchful eye of appointed special masters for three years as they implement more policies for how abused and neglected children are protected. That direction is necessary, she said, because the state has failed to address the system's problems "despite decades of awareness and extensive reports."

"Years later, the system remains broken and [Department of Family and Protective Services] has demonstrated an unwillingness to take tangible steps to fix the broken system," Jack wrote.

Hours after the ruling, Texas Attorney General Ken Paxton, a Republican, filed an appeal.

"The judge and the special masters acted outside of their legal authority and ordered a plan that is both incomplete and impractical," Paxton said in a statement.

The ruling comes more than two years after Jack initially ruled that the state’s foster care system violated children's civil rights. Texas Department of Family and Protective Services officials have been working with federal appointed special masters to evaluate how the state does with overseeing the child welfare system.

The ruling is a major blow to Republican Gov. Greg Abbott and legislators who rallied to come up with numerous child welfare bills during the 2017 Legislative session. Abbott, Paxton and state lawmakers have previously expressed dismay about federal interference — and were adamant that the state does not need oversight to overhaul the Department of Family and Protective Services.

“Texas has a solemn responsibility to care for children removed from their homes due to neglect and abuse of all kinds, and last year the Legislature approved landmark changes in the foster care system," Paxton said, explaining why the state will fight the ruling. "When unelected judges improperly assume control of state institutions, Texas officials cannot make the policy they’ve been entrusted to make."

That appeals process is likely to take at least a year, and in the meantime, the state must comply with the court's orders.

Paul Yetter, a Houston-based attorney and lead trial counsel for the foster youth, called the state's appeal hasty and misguided.

"This case is all about the children, and the state is focused on politics," Yetter said. "We have faith in the 5th Circuit that this careful ruling will be upheld."

The ruling ordered the state's Department of Family and Protective Services to make a top-down overhaul of the way it works with children and families, and then report on its progress to the federal court. Changes include giving caseworkers a limit of 14 to 17 caseloads; staggering the number of caseloads for new hires, and hiring more staff.

The department was also ordered to see top-priority children within 24 hours of when they were taken by Child Protective Services; mark in children's records if the children have been sexually abused; write a policy on what constitutes child-on-child sexual abuse, and no longer have children sleep in CPS offices overnight. If any children do spend a night in an office, the agency will be required to log it for a monthly report to the special masters.

DFPS referred a request for comment to Paxton's office.

Madeline McClure, CEO of the advocacy group TexProtects-Champions for Children, praised the ruling.

"The court has provided a roadmap for needed fixes — now it's time to implement it," she said in a statement Friday. "We must put the safety of our children first.”

State leaders and legislators have faced continued criticism for how they've handled the agency's troubles. Headline after headline described a state child welfare system stretched thin, with children sleeping in state offices and, in some cases, dying on the state's watch.

In October 2016, Abbott, Republican Lt. Gov. Dan Patrick and House Speaker Joe Straus, R-San Antonio, pressured both the department and legislators to make long-awaited changes to how the state helps children recover from abuse and find better living situations.

Legislators rallied with funding and bills. They gave the agency $150 million in emergency funds in December 2016 to offer higher salaries and hire more caseworkers. For the 2018-19 state budget, the Department of Family and Protective Services received $4 billion — up from $3.5 billion for the previous two-year cycle. That includes about $300 million to continue pay raises for caseworkers and another $88 million to more than 1,000 caseworkers over the next two years.

The department also has $95 million to boost payments to foster care families and other providers. The agency has touted that the extra funding has boosted morale among workers and helped them see more children in a timely manner.

Abbott expressed confidence when he signed a series of child welfare bills in May that Jack would "look at what Texas has accomplished" with the legislation and improvements the department had made.

Jack wrote in her ruling that officials' remedies "are indeed admirable." But, she wrote, "policies not practiced are of no value, and voluntary conduct of a defendant after the beginning of a suit cannot deprive a court of the power to order relief."

She also wrote that state officials have "taken minimal steps" to work with special masters to craft policies and were "limiting their participation to providing requested information."