Two Hong Kongers have pleaded guilty to conspiring to collude with foreign forces as well as Next Digital founder Jimmy Lai to endanger national security, local media reported.

In a separate case, local media said seven pro-democracy activists pleaded guilty to organising and inciting others to take part in an unauthorised assembly held in 2019.

The cases are part of a broad crackdown on dissent following anti-government protests that rocked the semiautonomous Chinese territory in 2019.

The protests were sparked by concerns that Beijing was infringing on the freedoms promised to the former British colony when it was handed to Chinese control in 1997.

In the first case, activist Andy Li and legal assistant Chan Tsz-wah pleaded guilty to a conspiracy where they sought to attract international sanctions against Beijing and the Hong Kong government, according to the South China Morning Post newspaper.

Li was one of 12 Hong Kongers who last year attempted to leave Hong Kong by boat and travel to the self-ruled island of Taiwan.

They were detained at sea by mainland authorities and 10 of them were sentenced to prison on the mainland for crossing borders illegally.

Li served seven months in Shenzhen jail before returning to Hong Kong, where he was remanded in custody.

The seven activists appearing in court in the second case included Raphael Wong, the former chairman of the League of Social Democrats political party, and Figo Chan, who led the Civil Human Rights Front, a now disbanded group that organised protests.

"I was protesting based on the principle of civil disobedience. One of the key elements of civil disobedience is to accept the charges. So that is what we are going to do later, to plead guilty," Wong said on Thursday ahead of the proceedings.

"Another key element is that the people carrying out civil disobedience actions know being jailed is just part of the process," he said.

"We are not worried about being jailed. Instead, we hope we can achieve democracy after this process."

Local news outlets Ming Pao and Stand News later reported all seven pleaded guilty.

Beijing responded to the 2019 protests by imposing a strict new national security law last year that has effectively criminalised much of the opposition to the government and silenced dissent.

Most of the city's most prominent activists, including Joshua Wong and Lai, the media mogul, are currently behind bars.

Many of them were prosecuted for taking part in unauthorised protests in 2019.

Of the seven defendants on Thursday, only Wong was not held in custody prior to appearing in court.

The other six are currently behind bars after being convicted of other offences related to their activism.