Political asylum
You may also be looking for a type of psychiatric hospital, also called an asylum.
Political asylum, usually called simply asylum, was a diplomatic procedure by which a sovereign entity granted someone protection from a hostile force.

In 2153, when the cogenitor "Charles" expressed a desire to leave the Vissian culture and remain aboard the , Captain Jonathan Archer considered it to be a request for asylum and informed the Vissian captain Drennik that it was something he had to take seriously. Ultimately, however, Archer chose not to grant this asylum and "Charles" later committed suicide. ()

Saru was granted asylum, in 2239, from his people into Starfleet on the condition that he not return to his home planet of Kaminar. ()

Michael Burnham asserted that Terran Emperor  should be given asylum by the Federation, as Burnham took her to escape a violent revolution against her rule in 2257. ()

In 2366, when Admiral Alidar Jarok's Romulan scout ship was pursued by a Romulan warbird and he reached Federation space, he requested asylum aboard the . ()

In 2367, the Kaelon Timicin requested asylum aboard the USS Enterprise-D in an attempt to challenge the ritualistic suicide custom called The Resolution. The same year, Klingon Ambassador  requested asylum aboard the USS Enterprise-D after he was exposed as an operative working for the Romulans. Captain Jean-Luc Picard, however, refused to grant asylum unless he was found innocent of any involvement in the attempted assassination of Governor Vagh. () 

In 2368, the crew of the Enterprise-D acted to protect the citizens of Moab IV from a stellar core fragment. Their discovery of the genetically-engineered society resulted in the society's own discovery of the progress which humanity had made. Though any loss would upset the balance of their society, many members of the society expressed a desire to leave. After Geordi La Forge discovered a deception created by the astrophysicist Hannah Bates to make everyone believe that the planet was still hopelessly doomed, she requested asylum onboard the Enterprise-D. In all, 23 of the citizens of Moab IV were granted, with reluctance, asylum by Captain Jean-Luc Picard. ()

That same year, Commander William T. Riker asked the J'naii leader Noor to allow Soren asylum on board the USS Enterprise-D in lieu of psychotectic treatment. ()

Also that same year, Picard offered asylum on the Enterprise-D to the Borg that had become known as "Hugh." He refused on the basis that it would endanger the vessel and particularly his new friend Geordi La Forge. ()

In 2369, the terrorist Tahna Los requested asylum from the Federation against the Cardassians. The same year, Miles O'Brien encouraged Tosk to request asylum, Tosk instead chose to die with honor. ()

In 2372, while in the Delta Quadrant, the  encountered a  who would later be known as Quinn, who requested asylum from Captain Janeway against the Q Continuum. Because the request was challenged by Q, Janeway convened and presided over a formal hearing, with Tuvok advocating for Quinn. Although it was unclear how exactly Janeway could protect him from the other Q, she granted Quinn's request. ()

That same year, Tuvok suggested that the apparent child Tressa might seek asylum with the Federation when she believed that members of her people, the Drayans, were trying to kill her. This ultimately proved unnecessary as Tressa was confused and they were trying to guide her to the natural end of her life, in which all Drayans reverted to state that resembled the youth of other species before naturally releasing the energy in their bodies. ()

In 2374, the Ramuran  requested asylum aboard Voyager after falling in love with Chakotay, though Chakotay had no memory of her previous encounter with her. The request for asylum was granted, but ultimately Kellin was found by a tracer and her own memories erased, at which point she decided to return to her people. ()

In 2381, the Pakled Rumdar requested asylum aboard the  in the midst of cease-fire negotiations on Pakled Planet, in an attempt at a ruse to conduct espionage for his people. 
Rumdar was quickly found out but allowed to remain in order for Jack Ransom and Kayshon to learn information from him. ()

External link

de:Asyl
Legal procedures