In around 1907, before World War One Britain, Germany and Russia teamed up to create the triple entente. France and Russia agreed that if either of them were attacked the would support each other. Great Britain joined to protect its empire, so we did not have to go to war.
Event in Morocco
In around 1882 Germany, Austria-Hungary and Italy formed the triple alliance. All these countries agreed with each other that if one was attacked or invaded, that the others have to support them militarily and go to war if needed.