If the theft-deterrent system detects an inappropriate entry into the vehicle, which could result in the vehicle or its contents being stolen, the alarm alerts the surrounding area of an abnormality by sounding the horn and flashing the hazard warning lights.
The system will not function unless it's properly armed. So when you leave the vehicle, follow the arming procedure correctly.
Operation
OperationMazda 6 Owners Manual: Contact Authorized Mazda Dealer and Have Vehicle Inspected
If any of the following warning lights or the indicator light turns on/flashes,
the system may have a malfunction. Contact an Authorized Mazda Dealer to have your
vehicle inspected.
...
Mazda 6 Owners Manual: Selector cable adjustment
1. Remove the center console.
2. Shift the selector lever to P position.
3. Unlock the lock piece of the selector cable (selector lever side) in the
order shown in the figure.
4. Verify that the manual shaft is in P position.
5. Lock the lock piece of the selector cable (selector lever side) ...