The question always comes up why a pistol any way.
It seems, if you look at the thread/postings over on the Beretta Forum that quite a few times the M9 has been used in house to house fighting, close-in encounters and sweeps of towns/villages in Iraq and Afghanistan.
The most famous was Marine Sgt. Bradley Kasal's use of the M9 when he was caught in a basement of a Fallujah house in 2004. Though severely wounded, he fought on and it's been recorded he killed six enemy with his M9.
A picture of him shows him holding his M9 in his right hand and gripping his K-Bar knife in his left while being helped out of the building.
As one poster commented, a relative reported the 9 mm quite effective if placed right and that the .45, again if it was placed right, was only marginally better.
So, no, the pistol in recent times hasn't just been a badge of rank/ceremony.