The court heard the offence happened between December 2020 and April 2021 at an Castle Terrace, Kennoway.
Procurator fiscal depute Claire Bremner told the court police carried out a search of Gourlay’s address in May last year and two mobile phones were seized – one from him and one from his bedroom.
A full forensic examination revealed the phones contained more than 650 indecent photos or videos of children.
The court heard there were more than 130 videos and more than 120 images of the most graphic kind, category A.
Gourlay, of Tolbooth Wynd in Anstruther, was told by Sheriff Ian Anderson to return for sentencing on August 30 pending the production of background reports.