Its quite obvious that the laws as shown in series are based on current day legal practices because it wouldn't be anything else, people have to follow the plot and creating random laws out of nowhere is not going to let that happen. The entire series is set out like that, for hundreds maybe thousands of years people have had to have training to count as a legal representative and I highly doubt it will ever change. The Federation and Starfleet have stupid laws and hypocritical rules just like the current day, so don't put them on a pedestal, they are as likely to screw up as anyone.
The fact is that Starfleet is a military, it has a rank structure identical to that of most western militaries, it uses large ships with very heavy armament to defend the area they have sworn an oath to protect. This isn't the coastguard and it sure as hell isn't a scientific flotilla like the ships that travel to Antarctica on a regular basis, up until TNG they even used technical terms for military craft. This argument is one that trek fans have had for years and especially in the last ten to twenty years or so, its been shown just how militarised Starfleet can get.