On the form I did for application for divorce the mediation was mandatory, or rather at least an attempt at it with confirmation this had been done or reasons why it hadn’t and these have been approved prior to the application. Aspects of what you agree on in mediation can later be put into a legally binding agreements such as consent orders.
Put it this way, in mediation you talk to ex about stuff with a referee in case things get out of hand. In contrast in court solicitors battle it out about what they think each of their clients should have.
If you want any kind of chance at being amicable try to make most of mediation and agree stuff between yourselves and use solicitor just to make things official, then you can avoid the stress and expense of court altogether… cause some solicitors can misrepresent their client’s wishes and think only of how much they can annihilate their opponent and make as much money for themselves in the process.