So If a command was given, Muhammad (AS) acts accordingly to the command (The will of the Lord)
An example: you know in strategy Game, when you move your troops, you select them, and you choose for them to go to a certain point, they follow the commands to the fullest without hesitation, even if it meant certain death, they obey, no question asked, if it was the will, then, obey.
So in fairness, I think your question was posed out of the frame.
There is no: how did he know he was on the right path? Do you know what is right and what is wrong?
Maybe what you consider is wrong, is right and what you consider right is wrong.
Muhammad (AS) had access to knowledge which only a prophet of God can have access to, like for example, the prophet Jakoob (AS) knew his son (Yousef (AS)) was alive, he asked the wolves, asked angel of death, he has access, which we do not posses.
Did someone miss that Russia actually made a deal with Saudi Arabia and sold them S-400 air defense missile? Don't you get it, these people are playing with the resistance and it is sadness that we buy and ask help from the enemy of Islam. It is us that gonna lose every war that they create, because that is how they make easy money.
actually, one such effort done is:
(1) Whosoever is an adherent to one of the four Sunni schools (Mathahib) of Islamic jurisprudence (Hanafi, Maliki, Shafi`i and Hanbali), the two Shi’i schools of Islamic jurisprudence (Ja`fari and Zaydi), the Ibadi school of Islamic jurisprudence and the Thahiri school of Islamic jurisprudence, is a Muslim.
but extreme wahhabis reject this. let's not be extremists like them.
i remember, during 2003 invasion of iraq, thousands of gi joes died.
today, the modern jihadists are their foot soldiers.
how to prevent this (being foot soldiers for US or some other entities) from repeating itself in future?
1. spread the fact that shiism is not majoosi/jewish creation.
2. while not belittling others, shiism has strong evidence to be the islam propagated by the Prophet, preserved through His Ahu Bayt as.
3. let's race towards good deeds - you don't have time to throw stones during a 100m dash, do you?