Acontroversial bill giving legal rights to an unborn child will be supported by the O'Farrell government under a deal with Christian Democrat MP Fred Nile in exchange for his support for crucial state budget legislation to privatise Newcastle Port.

The Reverend Nile said the government had promised to pass through the upper house ''Zoe's Law'', which creates a separate criminal offence for causing harm to or the destruction of a foetus and stemmed from the deaths of unborn children in driving accidents.

Not consulted: Brodie Donegan with Lachlan, 2, and Ashlee, 5. Credit:Jacky Ghossein

The government told Mr Nile it reserved the right to amend the bill in the lower house.

Upper house MPs were caught by surprise when the government supported an urgency motion to debate Zoe's Law on Thursday.