It's very unlikely that he is there to actually guard anything. In most countries, outside a state of emergency or war, soldiers do not have any right to shoot citizens in the streets. Even if someone specifically attacks the soldier, the correct response is to back away and call the police to handle it.
He's just standing there either for ceremonial reasons or for training (possibly both). In any case, his only task is to stand there and call the police if there's trouble.