走れメロス — is this based on a real Greek legend, or is 太宰治's version original?

走れメロス feels like it has Greek-myth energy (tyrant king, a hostage friend, a desperate run against time) but I don't know if 太宰治 invented the plot or adapted something existing. Anyone know the source?
Post
沐學 Mizuru