An Afghan journalist stunned viewers by appearing on television to present the news, moments after an attack by ISIL fighters at his station's premises in Kabul came to an end.

Defiant Parwiz Sapy appeared calm and collected on Shamshad TV as he announced to viewers on Tuesday: "The attack has ended."

Earlier, fighters with the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) had stormed the station in the Afghan capital.

A security guard was killed by the attackers, who were disguised as policemen. At least 24 others were wounded.

"Asalamualikum [Peace be upon you] Shamshad TV viewers, all staff members inside the building have been rescued," Sapy said in Pashto, his hands bandaged after breaking a window in the newsroom so his colleagues could flee the attack.

"We have all resumed our work, all our journalists are back on duty."

{articleGUID}

The station reported in a live broadcast that at least one attacker had blown himself up at the gate while another ran inside.

Afghan security forces battled the fighters and conducted a rescue operation that lasted almost four hours.

Broadcasting briefly stopped during the attack, pulling the channel off air.

"We were in the middle of our daily morning meeting when we heard gunfire," Sapy told Al Jazeera.

"The only escape route was a tiny window in our newsroom, so I ran towards it and punched it.

"I took out the bits and pieces of glass with my hands and shouted 'everyone get out from here!' and that is where most of us managed to escape from."

Shamshad has large audiences in areas where members of Pashtun ethnic groups are based, including areas of Afghanistan dominated by the Taliban.

The station had not received threats in the past.

Several social media users praised Sapy's response.

In case you missed it. This journalist stands for true resilience #ShamshadTV https://t.co/oPBcQZn4Kk — Waslat Hasrat-Nazimi (@WasHasNaz) November 8, 2017

Franz-Michael Skjold Mellbin, former EU ambassador and EU special representative for Afghanistan, tweeted: "Must admire Afghan journalist's resilience and determination."

Twitter user Naimat Khan said: "A very loud message to terrorists. You can beat armies but not journalists."

Carmen Fernandez, a Spanish journalist, wrote on Twitter: "Much respect."

Waslat Hasrat-Nazimi, a journalist with Deutsche Welle, said: "This journalist stands for true resilience".

Hamid A Saboory tweeted: "Moments after attackers were killed, Shamshad TV journalist back to work. High spirit and resilience can't be terrorised."

'Tears of happiness'

Sapy explained that at the time of his first live broadcast after the attack, he understood the "power of media" and that the experience made him adamant to continue his job as a journalist.

"We all had tears of happiness and were as motivated as ever to continue doing our jobs as journalists," he told Al Jazeera. "After this attack by militants, we knew we were doing something right."

Sapy and his colleagues refused to go home and waited outside the station until the operation was over.

{articleGUID}

"My family kept calling me over the phone asking me to return back home, but like my other colleagues, I did not leave," he said.

Shamshad TV broadcasts a variety of programmes including news and current affairs and it is one of the BBC's partner stations.

With a decade of experience in Afghanistan's media, Sapy believes that journalists are constantly under threat.

Afghan Journalists Safety Committee reported a surge in attacks against journalists with 73 cases recorded in 2017, an increase of 35 percent compared with 2016.

This makes Afghanistan the second most dangerous country for reporters in the world after Syria.

In May, ISIL claimed an attack targetting an Afghan state television building in Jalalabad that killed six people.

In January 2016, after threats from the Taliban, a minibus carrying TOLOnews employees was bombed, killing seven people during the evening rush hour.

The Taliban had openly threatened to target the television channel after it reported allegations of summary executions, rape, kidnappings and other abuses by Taliban fighters during the battle for Kunduz.

The armed group said at the time that the reports were inaccurate and threatened unspecified consequences.

"It is one of the most difficult countries to report from, but such attacks can only make us stronger," Sapy said. "My message to all young reporters is to continue doing your job. If they are attacking you, attack back with your journalism."

Follow Shereena Qazi on Twitter: @ShereenaQazi