A £250m dispute over who pays for nurses delivering social care in residential homes in Wales has been heard by the Supreme Court.
The NHS pays for 24-hour healthcare, while general care needs are funded privately or by the council.
But health boards and Welsh councils cannot agree who should pay when a person needs certain healthcare - but not around the clock.
Care home companies claim the row has left them waiting to be paid.
It prompted a group of care home owners to secure a judicial review which ruled in their favour.
But the health boards won an appeal - and that has now gone before the Supreme Court for a final ruling.
Richard Gordon QC, on behalf of Ceredigion council which is leading the councils' case, told law lords that Wednesday's hearing was "not just a technical dispute between two public bodies".
He said it "very much affects service users" in care homes in Wales.
The lawyer argued that whether a registered nurse was carrying out non-nursing duties, or doing nothing, for some of that time they were on duty and on call to carry out nursing tasks when needed.
In those circumstances, all funding should be provided by the health boards, he said.
Fenella Morris, QC for Cardiff and Vale University Health Board and the six other Welsh trusts, argued that if a nurse carried out a social care task, it did not make it an NHS obligation but work for a local authority.
"We say the NHS is entitled to decide that where a local authority is required to provide social care and a nurse is present to provide social care, it is not necessary for the NHS to pay the cost of that social care."
Clive Sheldon, the QC representing the secretary of state for health, added: "Local authorities can be required to arrange for and pay for services carried out by a registered nurse that do not need to be carried out by a registered nurse."
He added councils are arguing that an on-site qualified nurse was needed, whatever they did, and they should be paid for by the health service.
"We say that is an absurd consequence," said Mr Sheldon.
Judgement has now been reserved and the final decision by the five law lords hearing the case will be made later this year.
The case is already said to have run up a highly criticised legal costs bill of about £1m.