Why was the Berlin Wall Built?

The Berlin wall was built to keep the East Germans from escaping to West Germany. So many got away from East Germany through the years of 1949 to 1961.