 Prior to their invasion of his country, the Germans offered Andrić the opportunity to evacuate to neutral Switzerland. He declined on the basis that his staff would not be allowed to go with him. On 6 April 1941, the Germans and their allies invaded Yugoslavia. The country capitulated on 17 April and was subsequently partitioned between the Axis powers. In early June, Andrić and his staff were taken back to German-occupied Belgrade, where some were jailed. Andrić was retired from the diplomatic service, but refused to receive his pension or cooperate in any way with the puppet government the Germans had installed in Serbia. He was spared jail, but the Germans kept him under close surveillance throughout the occupation. Because of his Croat heritage, they had offered him the chance to settle in Zagreb, then the capital of the fascist puppet state known as the Independent State of Croatia, but he declined. Andrić spent the following three years in a friend's Belgrade apartment in conditions that some biographers liken to house arrest. He directed most of his energies towards writing, and during this time completed two of his best known novels, Na Drini ćuprija (The Bridge on the Drina) and Travnička hronika.
