WARNING: This page is about a different car, the 2009 Mazda 6. However, it is still accessible from the selected car via links, so may be relevant.
Disconnect the connector in the order shown in the figure.
CAUTION:
If sand or other particles get into the connector, it may be difficult to remove. In order not to damage the connector, be careful not to use excessive force removing the connector.