[What you need to know to start the day: Get New York Today in your inbox.]

On paper, a 31-year-old man found to have serious mental illnesses was released from a New York state prison in September 2017 after serving 10 years behind bars for two robberies.

But in reality, the man, who asked to be identified by his initials C.J., still wakes up each day inside a maximum-security prison in Stormville. Though he is technically free, he is still confined to a cell because of a Kafkaesque bureaucratic dilemma: The state requires people like him to be released to a supportive housing facility, but there is not one available.

Lawyers for C.J. and five other mentally ill men filed a federal lawsuit in Manhattan on Wednesday seeking to force Gov. Andrew M. Cuomo to address a shortage of housing for people with serious mental illnesses who need help adjusting to life outside prison walls.

The men are no longer being held in prison because they committed offenses, their lawyers argue, but because the state has determined they are likely to become homeless once released — a practice they contend amounts to discrimination under federal civil rights laws.