I'm sorry this is so upsetting and feel unfairly treated. If you made it clear you had no intent at all, I agree they overreacted with overkill. Did they actually arrest you? The only time they should do this, is if a person says they want to end their lives and have an immediate plan. Saying you've had the thoughts but no present intent, shouldn't warrant that kind of reaction.
If you ever want to share this again with a doctor - preface it with "I have no active intent". Sorry this happened to you.