The present invention relates to compounds of Formula (I) and (II) or a pharmaceutically acceptable salt, solvate, hydrate, tautomer, optical isomer, N-oxide, and/or prodrug thereof. The present invention also relates to pharmaceutical compositions comprising the compounds of the invention, and to their use in the treatment or prevention of medical conditions in which modulation of sortilin is beneficial.