I look at it this way. They were invaded by a foreign power masquerading as bandits. That's an act of war, which makes this a military action. As the only member of the margrave's household present, he was effectively commander of the local forces (just Frey in this instance).
While he had the attack power to take out the enemy, he was still outnumbered hundreds to one. He couldn't take them as prisoners of war. So he killed them. Any professional commander would have done the same.
The fake bandits were soldiers and spies. They knew the risks. Sucks for them, sure, but the risk of being killed in the line of duty is just part of being a soldier.