BANGKOK — Two journalists for the Reuters news agency were formally charged in Myanmar with obtaining state secrets, prosecutors said Wednesday, in a case seen as a key test of the country’s nascent political freedoms.

The reporters, U Wa Lone and U Kyaw Soe Oo, have been accused of violating the Official Secrets Act, a law dating to the British colonial period that carries a maximum punishment of 14 years in prison.

The journalists were brought to court in Yangon, Myanmar’s commercial capital, where they were arrested on Dec. 12, almost immediately after being given unidentified documents by members of the police.

Before their arrest, the journalists had been investigating the existence of a mass grave in Rakhine State, where a military campaign against Rohingya Muslims has sent more than 655,000 members of the persecuted minority fleeing to Bangladesh over the past four and a half months.