Did rulers in the middle ages and later actually believe that their rule was legitimized by god, or was it a pretence kept up for the rest? Did it change over time?

by sidhon
ungoogled

May I piggyback on this and ask about religion in the Middle Ages? I read once that during that time period, all people believed in God. Basically there was no atheism and everybody, no matter the class, believed that God existed. Is there validity in that statement or are there arguments against it?

Also, I know the posting rules are strict here so I apologize if I'm not supposed to have posted like I just did.

boostman

Follow up question: If people really did believe in the divine right of kings, why did people challenge/rebel against unpopular monarchs?