So, Pilecki was by no means a spy: he was a member of legal Polish intelligence agency, reporting to legal Polish government and passing intelligence information to our official allies (Poland had signed military pacts with both France and Great Britain in 1939).
What wasn't legal was the communist government that killed him in 1948, government formed by usurpers, backed by Soviet occupants.
Speaking of Pilecki, of course he thought he believed he was acting in the name of a legal government, but that's not what is being discussed here. The Soviets were correctly claiming him to be a foreign spy, since he was spying for a country which is foreign to the USSR, and treated him as such.
The question of which was the "real" Polish government is not in discussion, though you're repeatedly trying to derail the conversation towards that issue; my original comment was about the fact that the Soviets killed Pilecki by virtue of him being a spy, which was also common for other countries (unlike torture). Can we agree that the Soviets correctly viewed Pilecki as a foreign spy?
And how can they view Pilecki as a spy when he was providing intel to their British allies on their common enemy? Any reasonable country would consider Pilecki a hero, not a spy. You know, the old "Enemy of my enemy, friend of my friend" rule.
Unless of course Soviets were still respecting Ribbentrop-Molotov pact and considered Germans the allies and Brits the enemies, then prosecuting Pilecki for spying on Germans would make sense.
Enemy of the state -> Spy
It's OK to kill enemies of the state -> It's ok to kill spies