Although I doubt it would work for modern mortars. The thought of Saving Private Ryan came to mind. The scene where Matt Damon pulls the pin on a mortar and smacks the ass on a metal piece of detritus and throws it like a hand grenade.
In reality. There was this one situation where that idea came from during WW2. I really cannot think of the specific details apart from the gist of the story.
A soldier had his whole team wiped by germans and he was inside a destroyed building surrounded by them running up to it. He ran out of ammo and only had some mortars. Pulled the pins. Whacked against the wall and tossed them out the windows. The germans took losses enough to leavem alone.
When asked, how did you know that would work? He replied, that he didn’t know. But if he died by the germans or his bad idea. Dead was dead. So he took the risk.