The share of patients court-ordered to care in the state hospital system has risen from one in 10 in 2014, when the “bed of last resort” law took effect, to one in four, according to data analyzed by Heather Zelle, associate director of mental health policy research at the University of Virginia.