MIAMI (AP) -- Turns out the person three men tried to rob at a cash machine is a Miami-Dade police officer.

Police say the off-duty officer was withdrawing money from the ATM early Monday morning when he said three men pulled up in a truck, blocking the officer's car.

The men attacked the unidentified officer, who pulled out his gun and shot two of them. The would-be robbers are in stable condition in a hospital. The officer was not injured.