The ruling Socialists have a majority in parliament, meaning the bill should be easily approved.

Last month, the Constitutional Court delivered a blow to the government by banning the use of an existing single national database that kept, for a period of one year, data on telecommunications traffic of all citizens.

Such data were stored regardless of whether citizens were suspected of any crime.

The law that allowed that scheme had been in force since 2007, but the court ruled that it "disproportionately restricted the right to privacy". The Court of Justice of the European Union had also ruled that the law was invalid.

Justice Minister Catarina Sarmento e Castro said that the court's decision left Portugal without an important means of investigating serious crimes, such as terrorism, drug and people trafficking, which had been the sole purpose of the database.

"The decisions of the Constitutional Court are to be complied with. What we're doing now is taking a step forward and finding a way to access some information, but it's not the same," she told a news conference.

"So, we have changed the paradigm and we will (only) allow the access to the databases that all telecom operators maintain within the scope of their strict commercial activity," she said, adding such data were usually preserved for up to six months.

(Reporting by Sergio Goncalves; editing by David Evans)

By Sergio Goncalves