Then Ehud went out to the porch and shut the doors of the upper room behind himself and locked them. Bible

“and locked them.” In order to lock the door, Ehud would have had to have had the key, which he would have taken from the king.

Commentary for: Judges 3:23