WASHINGTON (AP) — President Barack Obama says he is banning the use of solitary confinement to punish juvenile offenders in federal prisons.

Obama says the practice of isolating prisoners can cause long-term psychological effects, particularly when used to punish young offenders and the mentally ill.

Obama announced the ban Monday evening in an op-ed on the Washington Post. It comes as part of a package of reforms aimed at curbing the use of solitary confinement in federal prisons.

The president says the changes will ensure that solitary confinement is a practice of “last resort” used when prisoners present a danger to themselves or others.

He says the new policy will affect 10,000 prisoners.

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.