Czech education played a central role in the policy of the young Czechoslovak state, especially in ethnically complex regions. It was a key instrument in the process of cementing national awareness, and the fledgling republic used the establishment of a school network as part of its propaganda. The state grammar school in Hlučín was established by a decree of the Ministry of Education and National Enlightenment on 6 August 1920 (only half a year after the territory was annexed) and was intended as proof of the state’s interest in the border region. Under Prussian rule, there had been no thought of founding a secondary school in the Hlučín area, and talented children had to commute to grammar schools in Racibórz, Głubczyce, or Austrian Opava.
The first temporary seat of the new school was the former Charlottenstift Orphanage, but talks about a new building soon began. The chosen site was by Nádražní Street, which planners envisaged turning into a modern thoroughfare lined with state offices and residential buildings in the coming years. The ministry entrusted the design to the Prague architect Bedřich Bendelmayer (1872–1932), a popular figure who spent the entire 1920s working on state commissions of this kind. The project was completed in August 1921, and construction took place in 1922–1925. Final approval, however, was not granted until 17 February 1927. The total cost came to approximately 3,660,000 crowns.
The building, conceived in the spirit of architectural traditionalism, takes the form of a monumental palace with a symmetrical façade and a clearly pronounced entrance axis. Lower annexes adjoin the central part on both sides. The southern one contained the flats of the headmaster and caretaker; the northern served as a gymnasium. The architectural treatment was intended to underscore the national character of the building. The top floor and the façades of the side wings were decorated with modern lozenge-pattern sgraffito, intended to recall the Czech Renaissance; the window frames were painted red and, together with the white and blue-grey of the façades, were meant to evoke the Czech tricolour. Above the entrance portal, a national coat of arms by the Prague mosaicist Marie Viktorie Foersterová (1867–1952) was installed, but it was removed as early as October 1938. It is now on display in the Hlučín Museum. The original façade treatment was lost during insensitive repairs in 1976. The school’s present name commemorates the fact that the Czech poet Josef Kainar studied here in 1935–1938.