Why is French spoken in Monaco?

Monaco is a tiny country of just a few square kilometers. It is surrounded by France on every side except for a little stretch on Mediterranean sea. Everywhere around it the language used is French and that small city was also a French-speaking one.