Was it illegal to murder the IF? Putting all emotions aside, looking at this from a purely legal sense, perhaps the Tsar could have been legally sentenced to death for treason. Frankly, I think that claim would have been legally unjustified. He was an incompetent ruler, but he didn’t deliberately betray his country in any way. I don’t see how one could legally execute someone for incompetence. However, as the military and political head of the nation they could have charged and tried Nicholas for treason and have executed him “legally” - from their perspective - on that basis.
Given Alexandra’s role (albeit more-or-less unofficial until about 1915) in government, she might have been tried on the same charges and perhaps her death could have been considered legal, too. I believe such a sentence would have been equally unjustified, though. Her only crimes were willful ignorance and hubris. Those merit exile, perhaps, but not the death penalty. She never actually committed the genuine crime of treason.
Now were the Bolsheviks capable of arranging anything other that a kangaroo court to try someone for their supposed crimes? No. The Purges in the 30s stand as proof of that. If one isn’t able to receive a fair trial than how could any execution be considered legal?
The children, meanwhile, had absolutely no role in government. I can’t imagine how anyone could legally justify their execution. It may have been politically expedient for the Bolsheviks to murder them, but that doesn’t make it legally justifiable. There simply weren’t genuine legal grounds for their execution. Think about it. What would the charge have been? Being born into the wrong socio-economic group, the wrong family? That isn’t a criminal offence. At least it isn’t in any lawful nation. Their execution certainly could not have been “legally” carried out according to the laws, as they stood in 1918, in either Western Europe or the United States, because they had not committed offences warranting the death penalty. However, they were not in Europe or the States. Was their "execution" legal according to the laws as set out by the Bolsheviks? Even if their execution hadn’t been legal the Soviets would have simply declared it to be legal after the fact. So that is basically a moot point.
I think Lisa makes an excellent point regarding Hitler’s rule and technical legality. Technically, everything he did - Anschluss, Lebensborn, the Holocaust, the experimentation on Polish prisoners, etc. - all of it was “legal”. Yet I don’t think any sane person would claim that it was just. Apartheid in South Africa was legal, but was it just? No. Segregation in the American South was also legal, but unjust. The past mistreatment of Aborigines in Australia (watch Rabbit-Proof Fence) was also legal but unjust. Was what the Belgians did in the Congo, brutalizing the Congolese, technically legal? Their King considered it legal, but it was unjust. You get the point.
Perhaps the real question should be were the Bolsheviks’ laws just, not were their actions legal. That question has no clear cut response (as pointed out by others) because it is a matter of opinion. IMHO the Bolshevik laws were arbitrary and unjust. After all, if the leader can rewrite the laws at will to suit his immediate political desires than how can those laws be considered anything other than arbitrary? For that matter how can any law dictated by one man, not the people, not a judicial body, but just one person be considered fair?