At the end of the day, I think the evidence shows that Starfleet is a military organization designed first-and-foremost to protect Federation interests.
But it wasn't. It was designed first and foremost to explore space and seek out new civilizations for peaceful contact.
The Doomsday Machine wrote:
DECKER: Our primary duty is to maintain life and safety of Federation planets. Do you deny that?
I had forgotten this in response to Spock's assertion: "Logically, our primary duty is to survive in order to warn Starfleet Command
." Significantly, immediately after Decker says this, Spock stops talking to him altogether and orders Sulu to go back to the Constellation.
The answer to Decker's question may very well by "No."