Emergency legislation designed to close a loophole in the law on mental health has been approved by the Commons.
It corrects a technical error affecting up to 5,000 patients sectioned under the Mental Health Act since 2002.
The error meant doctors who sectioned patients in England did not have the right authority to do so.
Health Secretary Jeremy Hunt insists all were qualified to make the clinical decisions and that no patient was wrongly detained.
He has ordered an independent review.
Mr Hunt said: "We believe that all the proper clinical processes were gone through when these patients were detained. They were detained by medically qualified doctors. We believe that no one is in hospital who shouldn't be and no patients have suffered because of this.
"But for the avoidance of any remaining doubt, and in the interests of the safety of patients themselves, as well as the potential concerns of their families and the staff who care for them, we are introducing emergency legislation to clarify the position."
A patient can be sectioned if they are perceived to be a threat to themselves or other people.
Generally, a patient can be sectioned only if two doctors and a mental-health professional believe it is necessary.
Doctors who assess patients and make recommendations under the Mental Health Act, are required to be "approved" to do so by the Secretary of State.
Since 2002, the Secretary of State has delegated that approval function to strategic health authorities (SHAs).
However, four out of the 10 SHAs in England asked mental health trusts to carry out the validation and approval process for them, but did not ask for it to be referred back to them for final confirmation.
This is the error that Mr Hunt says needs rectifying as a matter of urgency.
He said up to 2,000 doctors working for the four SHAs - North East, Yorkshire and The Humber, West Midlands and East Midlands - did not have the right approval to section patients sent to hospitals that included Ashworth and Rampton Secure Hospital.
The Department of Health has asked Dr Geoffrey Harris, chairman of NHS South and former chairman of Buckinghamshire Mental Health Trust, to undertake an independent review to look at how this responsibility was delegated by these four SHAs, and, more broadly, the governance and assurance processes that all SHAs use for delegating any responsibilities.
He will report back to the Secretary of State by the end of the year.
All doctors involved have now been approved under the correct processes.