There's a theory that Barrabas was a freedom fighter, that he led the 33 AD version of the PLO.
So when Pilate brought him before the crowd as the alternate for the crucifixion, he was going to be popular. Theory is that Barrabas and Judas knew each other. Barrabas suggested to Judas that he convince JC to use his powers to get the Romans out of Judea, all fired up by stories of Moses and the plagues in Egypt, Sodom and Gomorrah, that sort of thing.
Judas assured him that JC was doing his "Prince Of Peace" bit and wouldn't use his powers that way. So they hatched the plot so, when Barrabas was inevitably captured, Judas would betray JC so they ended up in jail together. The Barrabas could convince Jesus to get them both out and wipe out the Romans.
As it turned out, Barrabas got freed, JC got the cross, and Judas got hanged.