The Tartars defeated the Poles at the Battle of Legnica and destroyed most of Krakew , leaving only the castle and St. Andrew 's Church intact .
During the Battle of Legnica a large part of Krakew was ruined , but St. Andrew 's and the castle were undamaged .