Two prominent Turkish journalists from a leading opposition newspaper have been freed in the early hours of Friday after Turkey's top court ruled that their detentions had violated their rights.

The arrest of Can Dundar, editor-in-chief of Cumhuriyet, and Ankara bureau chief Erdem Gul last November drew international condemnation and revived concern about media freedom in Turkey under President Tayyip Erdogan.

They were detained after the publication of video footage purporting to show the state intelligence agency helping send weapons to Syria.

"We think the Constitutional Court's ruling is a historic one," Can Dundar told reporters outside the prison, next to their friends and families. "This verdict has cleared the way not only for us but for all of our colleagues and freedom of press and expression," he said.

The two were charged with intentionally aiding an armed terrorist organization and publishing material in violation of state security. Cumhuriyet published photos, videos and a report last May that it said showed intelligence officials transporting arms to Syria in trucks in 2014.

Despite their release, the two journalists are still facing possible life sentences at a trial which is due to start on March 25. They are also banned from leaving the country.

Erdogan, who has cast the newspaper's coverage as part of an attempt to undermine Turkey's global standing, said he would not forgive such reporting.