They operate in public, though. You can appeal a sentence, you have legal councel, the rules (e.g. the law) is clearly laid out.
>your local police chief isn't elected either and this doesn't necessarily mean he's a subversive anti-democratic element
Whats important is the element of secrecy. Cops are (somtimes, admittely) eventually brought to justice, with agents it's a completely different story. They get exchanged for favours or other agents and sent back to their home countries or in the case of domestic agents are usually demoted or even given a golden parachute. Here in Germany not one single official of our domestic secret service was held accountable for the scandal around the terrorist NSU organisation, they burned documents (the rest, hilariously enough, is longer locked away than the documents around JFK, more than a 100 years) and jack shit happened at all.
The key difference really is that all the above are theoretically able
to be held accountable by the public. Not so much with anything a secret service does.
>Well, I don't recall any great riots over the NSA being exposed
Dude, you're misinformed. Literally everyone who has any merit in this threw a major hissy fit. Noone touches crypto from NIST anymore, we completely replaced HTTP with HTTPS, pretty much all of the internet traffic now is encrypted. They got caught with their pants down and paid for it. The huge data collection facility in Utah is also a result of this, since they can't monitor everything as easily anymore, minus the SIGINT. I remember even american companies like Google being majorly pissed, that they tapped their fiber lines.
>counter-espionage and terrorism. We haven't had a terror attack on Portuguese citizens since some Armenians killed a Portuguese cop while massacring the Turkish embassy - so they must be successful on that end.
True, but thats a job a federal police force could just do aswell, if we're being honest, and also be held accountable by the public.