PORTLAND, Maine — An attorney for a Maine teen held for months at Long Creek Youth Development Center after being found incompetent to stand trial argued before the Maine law court on Monday that detaining him was unconstitutional because the state did not provide treatment to restore him to competency.

Sarah Branch represents the now 14-year-old, who was first detained at Long Creek when he was 11.

The teen has serious mental illness and cognitive disabilities, according to court documents.

The ACLU of Maine, Disability Rights Maine, GLBTQ Legal Advocates & Defenders, the Juvenile Law Center, Kids Legal, and the Maine Association of Criminal Defense Attorneys signed an amicus brief joining Branch in asking the law court to declare the teen's incarceration unconstitutional.

She said Monday afternoon that the underlying case against the teen has since been dismissed.

The case still seeks a declaratory judgement, Branch said, "for him, and for the next child in this situation ... he deserves a declaratory justice from this court that what happened to him was wrong."

In June, Maine Supreme Court Justice Ellen Gorman declined to release the teen, saying Maine has a "systematic lack or adequate resources" for youth with mental illnesses and cognitive disabilities.

Branch appealed the decision to the full law court in August.

The teen did not receive the federally-mandated treatment while at Long Creek, Branch said. She asked the law court to rule the detainment unconstitutional, in part to prevent it from happening to another juvenile in the future.

"Far too many Maine children are being locked up in youth prison because of a lack of mental health resources in the state," Branch told the justices. "That's a systemic problem ... This is an extraordinary case. Sadly, however, this case is not unique. Every time the state seeks to detain an incompetent child at Long Creek, these issues will be present."

The state director of the Office of Child and Family Services testified that Long Creek does not provide the recommended treatment level for the teen, according to the brief.

Assistant Attorney General Jason Antone, representing the Maine Department of Health and Human Services, told the court that the department "provided all the services it could with Long Creek while trying to get him [competency restoring] treatment" elsewhere.

"Improving care for at-risk youth, including those involved with the juvenile justice system, is a central focus of the Governor’s Children’s Cabinet and the Juvenile Justice System Assessment and Reinvestment Task Force," DHHS spokeswoman Jackie Farwell said Monday in an email to NEWS CENTER Maine. "In addition to participating in these efforts, the department is working strategically to build a foundation for a stronger system of care for youth throughout the state."

In a release Friday, ACLU of Maine staff attorney Emma Bond said, "It's a basic tenet of our justice system that we don't hold adults in prison who are incompetent to stand trial. Yet somehow, we've become comfortable with locking up kids with severe mental illness and cognitive disabilities. Just because they're kids doesn't mean we can completely ignore due process and put them in jail without a trial."

Jeffrey Skakalski, staff attorney for Disability Rights Maine, said to "warehouse" juveniles deemed mentally incompetent to stand trial is "unconscionable and illegal."

STORIES NEWS CENTER MAINE VIEWERS ARE READING

RELATED: Sen. Collins: I thought the president made a big mistake by asking China to get involved in investigating a political opponent.

RELATED: Puller at the fair drives truck...but PULLS heart strings

RELATED: Coast Guard releases audio from mayday call

RELATED: Man killed in logging accident in Ellsworth