If the selector lever will not move from P using the proper shift procedure, continue to hold down the brake pedal.

Take the vehicle to an Authorized Mazda Dealer to have the system checked.
Shift-Lock System
Manual Shift ModeSolenoid Valve Inspection [FS5 A EL]
CAUTION:
Water or foreign objects entering the connector can cause a poor connection
or corrosion. Be sure not to drop water or foreign objects on the connector
when disconnecting it.
Primary Control Valve Body
On-vehicle inspection
1. Perform the following procedures.
a. Rem ...
Drive Belt Auto Tensioner Inspection [Mzr 2.0, Mzr 2.5]
MZR 2.0
1. Remove the generator drive belt with the A/C drive belt still installed and
set it out of the way..
2. Verify that the drive belt auto tensioner moves smoothly in the operational
direction.
If it does not move smoothly, replace the drive belt auto tensioner..
3. T ...
Crankshaft Position (CKP) Sensor Inspection [Mzr 2.0, Mzr 2.5]
Visual Inspection
CAUTION:
When foreign material such as an iron chip is on the CKP sensor, it can cause
abnormal output from the sensor because of flux turbulence and adversely affect
the engine control. Be sure there is no foreign material on the CKP sensor when
replacing.
...