was just shut down in her bid to leave the psychiatric hospital where she has been held against her will for more than a week ... TMZ has learned.
Amanda appeared before a judge in the psych ward, as her lawyer argued there was no legal basis to hold her for the two additional weeks ... sources familiar with the situation tell TMZ.
We broke the story ... Amanda was placed on a 5150 psychiatric hold 10 days ago after starting a fire in the driveway of a home near L.A. The hold lasted 3 days, and then doctors stepped in and got a judge to extend the hold for 2 additional weeks so they could properly diagnose her.
Our sources say Amanda's lawyer argued at today's hearing the actress was capable of caring for herself and she was not a danger to others. As we reported, Amanda is actually doing a lot better since doctors have started giving her a cocktail of meds. We're told there are clear signs Amanda is schizophrenic.
In the end the judge agreed with the doctors, that Amanda needed to stay in the hospital because her mental situation is still precarious. Amanda does not acknowledge she has a mental illness, and doctors believe there's more than a good chance she would not take the meds that have stabilized her if she's out on her own.