When it is said
Pray it for someone whose illness is of the mind, or of the body, or both.
It also fits your own illness, since it asks help for all the sick together.
Where it comes from
No author known
Where it comes from
The prayer belongs to a Mass for the sick in the Old Gelasian book, the second oldest Latin service book to survive. Its one manuscript, now in the Vatican Library, was copied in the land of the Franks about AD 750. Much of the book goes back to prayers of the Church of Rome written between AD 628 and 715.
H. A. Wilson, The Gelasian Sacramentary (Oxford, 1894), page 282; The Cult of Saints in Late Antiquity database, University of Oxford, record E07005
The rest of the Mass
The Mass this prayer belongs to opens by asking God to hear us for the sick, so that once their health is restored they can thank Him in His church. Its closing prayer calls God the one defence of human weakness and asks Him again to show His helping power to the sick.
H. A. Wilson, The Gelasian Sacramentary (Oxford, 1894), page 282
What the words mean
Minds or souls?
The Latin word for minds here is animus. Its first meaning is the reasoning soul as against the body, and in a narrower sense it is the mind that thinks, feels and wills. So the prayer sets sickness of the mind beside sickness of the body and asks the same help for both.
Charlton T. Lewis and Charles Short, A Latin Dictionary, on the Perseus Digital Library
In Latin
Omnipotens sempiterne Deus,
qui aegritudines et animorum depellis et corporum,
auxilii tui super infirmos nostros ostende virtutem;
ut ope misericordiae tuae ad omnia pietatis tuae reparentur officia. Per.
From the Gelasian Sacramentary, ed. H. A. Wilson (Oxford, 1894), page 282, on archive.org.