this discussion of Starfleet's non-military status has gotten me wondering... I have seen it said that the Federation is a loose interpretation of the United States and United Nations systems of government.
Under the Law of Land Warfare, as recognized by those two institutions, a nation must define who it's combattants are... ie: who is it's military. In some nations police forces are considered combattants, in others they're not. Non-combattants are not allowed to participate in the fighting in any capacity. There are provisions for partisans, but in general a noncombattant who participates in battle becomes a criminal... or perhaps a spy, depending on the circumstances of their capture.
If Starfleet isn't military, if Starfleet officers and enlisted aren't soldiers, how can they legally fight to defend the Federation?
If the Federation takes the position that EVERY citizen can bear arms in defense of the Federation according to the dictates of their concience... then every citizen of the Federation is a legitimate military target.
If (as I suspect) the Federation has designated Starfleet (and the various Planetary Defense Forces) as the Federation's combattants, then Starfleet is a military Armed Force even if it isn't their primary role, and even if they don't want the designation... just as the US Coast Guard is a military Armed Force even though it's not normally under the direction of the Department of Defense.
In fact, I would suggest that the US Coast Guard is really the closest analogy to Starfleet in the modern era... they do scientific exploration, law enforcement, maritime safety, maritime qualification and licensing... and have a military mission as well, that they fulfill every day not just when the US is officially at war.
------------------
"I'd rather die standing than live on my knees..."
Shania Twain