Staff and patients were told to lock themselves into wards and offices after the incident on the morning of Thursday, November 22.
The condition of the female nurse is unknown and nobody else is believed to have been injured.
Ailsa Hospital cares mainly for elderly patients but has a 52-bed Intensive Psychiatric Care Unit.
Nurse stabbed in grounds of Ayr's Ailsa Hospital as nearby Ayr Hospital placed on lockdown by police
— Free_Speech (@Jealous_Society) 22 November 2018
The attack took place in the grounds of Ayr's Ailsa Hospital shortly after 10am this morning. pic.twitter.com/2QGNQW6eoT
"Around 10.05am on Thursday November 22, police received a report that a woman had been attacked in the grounds of Ailsa Hospital, Dalmellington Road, Ayr," said a spokesman for Police Scotland.
"NHS Ayrshire & Arran is aware of an incident in the grounds of Ailsa Hospital this morning.
"We are assisting Police Scotland with their investigations, and to ensure the safety of staff, patients and visitors. We are unable to comment any further at this time," said NHS Ayshire and Arran.

