The West Bank Walls

Why did Israel construct the West Bank Walls and why do Palestinians oppose them?  If you were a World Court Judge and Israel and the Palestine Authority agreed to let you decide whether the walls should remain or be torn down, what would you rule?  And why?