Poorer access to community mental health services may have led to rise in detentions