Bolivia 's Congress accepted the resignation of President Carlos Mesa late on Thursday night and swore in the head of the Supreme Court as the new president , an appointment expected to defuse more than three weeks of protests that have paralyzed the nation .