Set in the fictional European kingdom of Lutha, the protagonist is a young American named Barney Custer, of Beatrice, Nebraska, who is the son of an American farmer and a runaway Luthan princess, Victoria Rubinroth. Unaware of his royal blood, much less that he is a dead ringer for his relative Leopold, the current king of Lutha, Barney visits Lutha on the eve of the First World War to see for himself his mother's native land. As he arrives in Lutha, King Leopold has just escaped from his ten years' imprisonment at the hands of his scheming uncle, Prince Peter of Blentz. Much to his own and everyone else's confusion, Barney is naturally mistaken for the king, leading to numerous complications.
Barney meets and falls in love with Princess Emma Von Der Tann, Leopold's promised bride and then becomes intimately involved in Luthan affairs, working to help the king and ultimately allowing himself to be proclaimed as king while impersonating Leopold to prevent Prince Peter from seizing the throne. He finally succeeds in foiling Peter's plans to become king himself by rescuing and fighting for the real king. Unfortunately, after his coronation, King Leopold discovers the shared love between Barney and Princess Emma, and Barney is forced to leave Lutha, mimicking the flight of his father years earlier, though his father left with a princessâBarney has only a soldier. Thus ends part one.
In the second part of the novel, the European skies are darkening as World War I has begun. In Lutha, King Leopold has proven himself to be a bad ruler and has not yet persuaded Princess Emma to marry him. In Nebraska, Barney's soldier friend leaves the farm to return to Lutha. Barney himself is attacked by one of Prince Peter's henchmen and he decides to return to Lutha as well. After an adventurous trip across war-torn Europe, which includes being mistaken for a spy by the Austrians and barely escaping a firing squad, Barney finally reaches Lutha, where he once again is forced to impersonate the king in order to save Lutha from the advancing Austrians. He makes a diplomatic alliance with Serbia, and defeats the Austrians in person, thereby saving Lutha. The real king Leopold, who has been his antagonist throughout the second part of the novel, is mistaken for Barney and killed by one of Prince Peter's henchmen. Barney then consents to remain as king of Lutha, married at last to Princess Emma.

Question: Why is Barney Custer nearly executed by the Austrians?
Answer: He is thought to be a spy
Alternative answer: being mistaken for a spy