For the best protection against friendly fire accidents we recommend joining a coalition. This will not allow wars between coalition members.
With simply shared map there are several actions that can cause war accidentally.
When you have a pair of units engaged in combat when peace or higher relation is shared this will NOT end this particular combat. They will return to combat at the next combat cycle and cause war again unless they are separated. In order to separate them you will need to share right of way or higher and then move them apart.