In 'Birthright, Part One', Picard told Data that he was a culture of one. While not quite true - B4, Lore, Julianna Tainer, Lal were also a part of the culture created by Soong - its close enough.
And since the Federation respects each culture's laws & customs, when Data passed judgment on the only other known member of the culture, it was legal.
And who gave Data the right to decide what his cultures laws and customs were? Lore's opinion should count as much as Data's if not more, considering the fact that he was built first and established Soong android culture long before Data was activated for the first time.
What Data did was wrong, plain and simple. He fought for his rights to not be treated like a thing and then he deactivates Lore just like that ... what a load of crap. Yes, Lore was dangerous and he could have escaped had they just put him in a cell ... so what? If you lock a criminal up there's always the chance he or she will escape, but I don't see the federation putting people into stasis indefinitely or outright killing them, they send their criminals to an extended vacation in New Zealand instead.