When surrounded, best get out of the way! (5)

I believe the answer is:
beset
'when surrounded' is the definition.
'beset' can be an answer for 'surrounded' (I've seen this before). I am not sure about the 'when' bit.
'best get out of the way' is the wordplay.
'get' indicates putting letters inside.
'out of the way' becomes 'e' (I can't explain this - if you can you should believe this answer much more).
'best' enclosing 'e' is 'BESET'.
Can you help me to learn more?
(Other definitions for beset that I've seen before include "Beleaguer" , "Hem in, afflict" , "Surround (with problems)" , "Plagued" , "Surrounded, under siege" .)
