Theresa May will pledge to scrap the “flawed” Mental Health Act, warning that it has allowed the unnecessary detention of thousands of people and failed to deal with discrimination against ethnic minority patients.

In an attempt to meet her pledge to prioritise mental illness during her premiership, she will commit to ripping up the 30-year-old legislation and replace it with new laws designed to halt a steep rise in the number of people being detained. Increased thresholds for detention would be drawn up in a new mental health treatment bill to be unveiled soon after a Conservative victory. Mental health charities, clinicians and patients would be consulted on the new legislation.

While the announcement is likely to be welcomed by mental health campaigners, there will be warnings that a lack of resources, rather than badly drafted laws, has been the real driver of the increase in detention.

The overhaul is being described by the Conservatives as the biggest change to the law on mental health treatment in more than three decades.

“On my first day in Downing Street last July, I described shortfalls in mental health services as one of the burning injustices in our country,” May said. “It is abundantly clear to me that the discriminatory use of a law passed more than three decades ago is a key part of the reason for this.

“So today I am pledging to rip up the 1983 act and introduce in its place a new law which finally confronts the discrimination and unnecessary detention that takes place too often. We are going to roll out mental health support to every school in the country, ensure that mental health is taken far more seriously in the workplace, and raise standards of care.”

More than 63,000 people were detained under the Mental Health Act in 2014-15, an increase of 43% compared with 2005-06. Black people are also disproportionately affected – with a detention rate of 56.9 per 100 patients who spent time in hospital for mental illness. It compares with a rate of 37.5 per 100 among white patients.

In its last report on the act, the Care Quality Commission, the independent regulator of healthcare services, said it had “failings that may disempower patients, prevent people from exercising legal rights, and ultimately impede recovery or even amount to unlawful and unethical practice”.

The new legislation would include a code of practice aimed at reducing the disproportionate use of mental health detention for minority groups and countering “unconscious bias”. Safeguards would be introduced to end rules that mean those who are detained can be treated against their will. Those with the capacity to give or refuse consent would be able to do so.

The new bill would form part of a series of measures designed to improve mental health in schools and the workplace. However, ministers would face immediate questions over whether they were providing sufficient funding for their plans.

The Tories would commit to hiring 10,000 staff in the NHS by 2020. An insider said the plan would be funded from existing budgets, because mental health service funding will be up by £1.4bn in real terms by 2020.

The Equalities Act would also be altered to prevent workplace discrimination. Currently patients who have conditions such as depression, anxiety and bipolar disorder are only protected from discrimination if their condition is continuous for 12 months. That would be altered to take account of the fact that the conditions are often intermittent.

Every primary and secondary school in England and Wales would have staff trained in mental health first aid and be given a single point of contact with local mental health services. Children would be taught more about mental health, including keeping safe online and cyber-bullying.

Large companies would be required to train mental health first responders alongside traditional first aiders.