A social worker was held at knifepoint by a woman with mental health problems.
Laura Craven, 21, refused to allow the social worker to leave her flat in Eastbourne during the incident.
Soon after the police arrived, Katherine Pearson was freed unharmed.
At Lewes Crown Court Craven admitted a charge of false imprisonment.
Stephen John, prosecuting, told the court Ms Pearson visited Craven on the afternoon of January 13 at her flat in Etchingham Road, Eastbourne, and was due to have a joint meeting with a representative from the South Downs Housing Association.
But when she arrived, she noticed Craven was behaving strangely and appeared agitated.
He told the court: "Craven left the lounge and returned to the room holding a large knife.
"Ms Pearson told her to put it down. She asked to leave and was told she could not. She made attempts to reason with her but the defendant locked the front door."
At that point the representative from the housing association telephoned Ms Pearson, who informed her the defendant had a large knife and she was not allowed out of the flat.
The police were alerted and arrived minutes later. At first Craven refused to let police into her flat but soon afterwards she unlocked the door. No one was harmed.
Judge Richard Brown made an interim hospital order. Craven will stay at a mental hospital for a psychiatric assessment for 12 weeks. She will return to court on August 3.
The judge told her: "The courts have a duty to do what they can to protect health service workers but on the other hand we have to recognise that if this behaviour may be due to a psychiatric disorder it is our duty to see if the problems can be treated.
"If they can, the defendant can be returned to the community and the community is no longer at risk."
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules hereComments are closed on this article