In the dim light of the torches, it was difficult to distinguish any individual, so Judas had agreed in advance upon the signal. The man whom he would greet with the traditional greeting of a disciple for his master, a kiss upon the forehead, would be the man they sought ~ Mark 14:44.
The disciples were very much afraid, but they loved their Master far too much to allow him to be taken without a struggle. Peter, in his usual impetuous way, drew his sword and aimed a blow at the head of one of the group of soldiers -John 18: 1 O. He happened to be a servant of the high priest. Either because the light was bad or because his aim was poor, Peter missed his mark and struck the man's right ear. Jesus immediately saw Peter's plight. He was in danger of being struck to the ground by the Roman soldiers. This is implied in the words of Jesus as he restored the servant's ear: For all who draw the sword will die by the sword - Matthew 26:52