The Mental Capacity Act 2005 (MCA) provides a legal framework for making a wide range of decisions on behalf of people who are said to lack mental capacity, or for helping people to plan ahead for a time when they may be unable to make decisions. You can read the Act itself on the Legislation.gov website. The MCA applies in England or Wales (Scotland has separate legislation on adult incapacity, and Northern Ireland is currently drafting new legislation on the subject).
The MCA also has two Codes of Practice – one for the main provisions of the MCA and one on the legal framework for deprivation of liberty under the MCA often referred to as the deprivation of liberty safeguards or ‘DOLS’. These contain a lot of useful and readable information about the MCA and are good place to start.