In particular, the military is, at least in liberal democracies, generally not supposed to engage in domestic law enforcement which Starfleet fairly often does.
No matter how you look at that, it doesn't make sense. Even if we entertain the idea Starfleet is a non-military space exploration service, why would space explorers engage in domestic law enforcement on a regular basis?
However, Starfleet’s primary mission has always been the pursuit of peaceful exploration and scientific discovery, with secondary focuses of defense, diplomacy and other public services.
Defense is never secondary. After all, when the Borg or the Dominion come calling, Starfleet never just sits back and says "Not dealing with that today. Today we're exploring/doing science."
Starfleet always attempts to first seek a peaceful resolution to potential conflicts, resorting to the use of force only as a last resort.
Contrary to popular belief, militaries don't always solve problems by coming in with guns blazing and shooting first and asking questions never. Most militaries will gladly resort to force as a last resort as well.
Indeed, that tends to be a problem with Star Trek's depiction of military, including the intentionally militaristic takes on Starfleet we see in the Mirror Universe or Yesterday's Enterprise. The military are always depicted as bad tempered stern aggressors with uniforms that either have stiff collars, shoulder epaulets, or visible belts that only know violence that can't solve the problems as opposed to Starfleet which tries to avoid violence and find the solution diplomatically or scientifically that turns out to be obvious but the military is too stubborn to see. We see this play out in Disco's third season where Disco arrives in 32nd century Earth to find Starfleet and the Federation have been expelled and Earth is now defended by the United Earth Defense Force which fires on anything that enters Earth orbit and have trouble being harassed by alien raiders. But then the peaceful Starfleet arrives and reveals through diplomacy that the so called alien raiders are actually human refugees from elsewhere in the Sol System. Or then there's 32nd century Starfleet, which has had to abandon science and exploration to focus solely on defending what's left of the Federation and therefore never learned what caused the Burn for an entire century. But then Disco and its crew of explorers from the Federation's halcyon days show up and by disobeying orders they conduct science and learn the cause of the Burn in a matter of months.
In reality, there are situations where the military can find a peaceful solution, just as even on Star Trek there are situations where Starfleet shoots first and asks questions later, despite the franchise's party line to the contrary on both counts.
I started the thread because I've never had or heard this discussion and I wanted to see what a bunch of smart, informed, and erudite people thought.
I'm finding it fun and thought-provoking, but don't feel you have to play if you don't want to.
I meant no disrespect towards you. My comment was in response to
MLB wondering why this is still debated in light of a line from Picard, despite the fact that this has been debated before in light of similar lines in the other shows and movies.