The principle of in dubio pro reo (Latin for "[when] in doubt, rule for the accused")[1][2] means that a defendant may not be convicted by the court when doubts about their guilt remain.
The rule of lenity is the doctrine that ambiguity should be resolved in favour of the more lenient punishment.[3]
To resolve all doubts in favour of the accused is in consonance with the principle of presumption of innocence.[3]