Parliament has passed legislation to increase the length of time jailed mothers can keep their babies with them.
The amendment to the Corrections Act, a Green Party initiative, was passed unanimously under urgency on Thursday.
It allows mothers in prison to keep their babies with them until the child turns two, rather than six months.
Corrections Minister Phil Goff says children suffer the consequences when mothers are sent to prison.
He says eight mother and baby units will be established in Auckland and Christchurch women's prisons, at a cost of $2 million.