Midrash Rabbah Lamentations 2.2 4
For three and a half years the emperor Hadrian surrounded Bethar. In the city was rabbi Eleazar of Mode'in [5], who continually wore sackcloth and fasted, and used to pray daily: 'Lord of the universe, sit not in judgment today!' so that Hadrian thought of returning home [6].
A Cuthean [7] went [to the emperor] and found him and said: 'My lord, so long as that old cock wallows in ashes, you will not conquer the city. But wait for me, because I will do something that will enable you to subdue it to-day.'
He immediately entered the gate of the city, where he found rabbi Eleazar standing and praying. He pretended to whisper in the ear of rabbi Eleazar of Mode'in. People went and informed Bar Kozeba: 'Your friend, rabbi Eleazar, wishes to surrender the city to Hadrian.'
He sent and had the Cuthean brought to him and asked: 'What did you say to him?'
He replied: 'If I tell you, the emperor will kill me; and if I do not tell you, you will kill me. It is better that I should kill myself and the secrets of the government be not divulged.'
Bar Kozeba was convinced that rabbi Eleazar wanted to surrender the city, so when the latter finished his praying, he had him brought into his presence and asked him: 'What did the Cuthean tell you?'
He answered: 'I do not know what he whispered in my ear, nor did I hear anything, because I was standing in prayer and am unaware what he said.'
{Simeon} Bar Kozeba flew into a rage, kicked him with his foot and killed him. A heavenly voice issued forth and proclaimed: 'Woe to the worthless shepherd that leaveth the flock! The sword shall be upon his arm, and upon his right arm!'[8]
It was intimated to him, 'Thou hast paralyzed the arm of Israel and blinded their right eye; therefore shall thy arm wither and thy right arm grow dim!'
Forthwith the sins [of the people] caused Bethar to be captured. {Simeon} Bar Kozeba was slain and his head taken to Hadrian. He asked: 'Who killed him?'
A Cuthean said to him: 'I killed him.'
'Bring his body to me,' he ordered.
He went and and found a snake encircling its neck. So Hadrian, when told of this, exclaimed: 'If his God had not slain him, who could have overcome him?' [9]
And there was applied to him the verse: Except their rock had given them over.[10]