A Boston man charged with stealing a wedding limousine tried to escape from custody using a fake gun made out of soap, but he was foiled by a karate-trained deputy, authorities said.

Michael Callahan, 35, was being taken from a holding cell in the basement of Dorchester District Court on Friday when Callahan pulled out the bogus gun, officers said.Suffolk County Sheriff Robert Rufo said Callahan brandished the "gun" and told Deputy Frederick Pollini, who was escorting him: "Get up against the wall." The deputy began to back off, then knocked the bogus weapon out of his hand with a karate chop. Pollini and a court officer then subdued Callahan.

The sheriff said the soap gun was "very realistic, especially when he cupped it in his hand and all that showed was a four-inch barrel."