The castle, located at the confluence of the Nemunas and Neris rivers, was built in the 14th century to repel attacks by the Teutonic Knights. It is not only one of the first brick castles in Lithuania, but also the only one with two rows of defensive walls. A settlement developed around this Gothic defensive structure, which grew into the current city. The castle was first mentioned in written sources in 1361.