NEW YORK (AP) _ Two judges barred New York City on Wednesday from starting a program to put children in foster care if their parents seek city shelter but refuse to accept work assignments.

State Supreme Court Justices Elliott Wilk and Helen Freedman signed orders that bar the city from expelling homeless families from shelters, or from taking children from families on the grounds that the adults are not providing shelter for them.

The policy, supported by Mayor Rudolph Giuliani, ``strikes terror in the hearts of people with children,'' Wilk said.

City counsel Michael Hess said the city would appeal.

``All of the issues in this matter had been previously been ruled on in the city's favor and today the rule of law has been totally ignored,'' he said in a statement.

City officials had previously announced that on Dec. 13, they would start enforcing state rules requiring homeless families who seek shelter to comply with all public assistance rules, which include accepting workfare jobs.

If adults do not accept workfare assignments, they risk losing their municipal shelter and seeing their children placed in foster care because they lack shelter, Human Resources Administration officials said.

Meanwhile, police have been arresting homeless people who refuse orders to move from sidewalks. That element of the city's homeless policy was not before the court.

Two judges heard the proceeding, requested by the Legal Aid Society, because each had heard and ruled on different but similar cases involving homeless shelters. Both signed temporary restraining orders.

``This is really a misguided policy, and I think it's time for the mayor to rethink it,'' said Steven Banks of Legal Aid. ``It doesn't make since to whipsaw families like this.''