(CNN) The Chinese embassy in Berlin has warned its nationals to respect local laws after two Chinese tourists were detained for performing a Nazi salute in front of the city's parliament building.

The tourists were arrested after posing for photos while making the Nazi gesture in front of the historic Reichstag building, a popular tourist destination, on Saturday.

German law forbids the use of some symbols affiliated with banned organizations in public, such as gestures, uniforms and flags, including those linked to the Nazis.

The tourists claimed the gesture had been meant as a joke. They were charged for violating the ban and fined 500 euros each, the Chinese embassy said Sunday, and have now left Germany to continue their trip elsewhere.

The embassy suggested that tourists traveling abroad from China should take care to respect local laws and raised concerns that such controversies would harm the country's image.

Read More