You do not have to wait for an accident: you can take preventive action. If you have reasonable grounds to fear the collapse or partial ruin of a neighboring building, you can require the owner to take the necessary measures to prevent this ruin (art. 90).
The demand may be directed against the owner of the building, or the person who would be liable under article 89 (art. 90).
If the collapse occurs despite this, liability is clearly defined: the owner of a building or other structure is liable for damage caused by its collapse or partial ruin, when this results from deterioration, lack of maintenance, or a defect in construction (art. 89).
Two useful distinctions:
- When a person other than the owner is required to ensure maintenance (by contract, usufruct, or other real right), it is this person who is liable (art. 89).
- In the event of a dispute over ownership, liability falls on the current possessor of the property (art. 89).
Begin therefore with a demand for preventive measures; in the event of damage, compensation will follow the rules of article 89.
This is general legal information, not legal advice. For advice on your specific situation, consult a lawyer admitted to the Bar in Morocco.