Which writ can be issued in case of illegal arrest ?

Which writ can be issued in case of illegal arrest ?

Mandamus
Habeas corpus
Quo warranto
Prohibition
This question was previously asked in
UPSC Combined Section Officer – 2021-22
The correct answer is B) Habeas corpus.
The writ of Habeas Corpus (meaning ‘to have the body of’) is issued by a court to a person or authority who has detained another person, directing them to produce the body of the detained person before the court. The court then examines the legality of the detention and, if found to be illegal, orders the release of the person. This writ is a crucial safeguard against arbitrary arrest and detention.
Mandamus is a command to perform a public duty. Quo Warranto challenges the authority by which a person holds a public office. Prohibition is issued by a higher court to a lower court or tribunal to prevent it from exceeding its jurisdiction.