During supper, when the devil had already put it into the heart of Judas Iscariot, Simon's son, to betray him,
(John 13:2 )
For he knew who was to betray him; that was why he said, “Not all of you are clean.”
(John 13:11)
I am not speaking of all of you; I know whom I have chosen. But the Scripture will be fulfilled, ‘He who ate my bread has lifted his heel against me.’
(John 13:18)
The message is clear. Jesus did not wash Judas' feet and then wish he could take it back after Judas betrays him. Jesus washed Judas' feet knowing full well what Judas was about to do. That's loving your enemy.