“NCIS” bid farewell to a fan-favorite character Tuesday. Tony DiNozzo officially turned in his badge to begin a new life in the Season 13 finale. Despite Ziva David being absent in Tony’s last episode of the CBS drama, she played a major part in Tony’s decision to leave.

After an explosion at a farmhouse where Ziva (Cote de Pablo) lives, Tony (Michael Weatherly) decides he needs to be in Tel Aviv, and the team books him a flight. Before Tony can even get on a plane, Ziva’s death is confirmed.

Tony wants revenge. He is ready to take down Kort (David Dayan Fisher), the man who killed Ziva, but Gibbs (Mark Harmon) sends Tony home to grieve. He gets called back to the office when Mossad Director Orli Elbaz (Marina Sirtis) brings a special guest: his daughter.

A toddler who is named Tali (Emelia Golfieri, Layla Golfieri) in memory of Ziva’s dead sister is the lone survivor of the fire. Tony is shocked Ziva was pregnant and says he would’ve been there if he’d known. Elbaz says Ziva didn’t want to interrupt his life. Luckily, Tony is great with the little girl, but he is still mourning. Typical of Ziva, she had packed a to-go bag for Tali and herself, and Tony can’t help but be sad when he smells one of her old scarves.

NCIS Tony Leaves Tony (Michael Weatherly, left) relied on his father (Robert Wagner) to help take care of Tali in the “NCIS” Season 13 finale. Photo: CBS

Friends and relatives help Tony care for Tali. Palmer (Brian Dietzen) comes over with food and babyproofing gear. He asks whether Tony will ever come back to work, and Tony appears to find the question silly. Palmer goes on to say it’s tough being a single parent in the line of duty, and Tali will probably want to follow in DiNozzo’s footsteps. Tony doesn’t look happy about that idea.

On a walk in the park with McGee (Sean Murray) and Tali, Tony refuses to kiss and tell when McGee asks whether he and Ziva had always been an item. He says they had a “fond farewell,” but he won’t give any details. Tony says he loved Ziva, though.

Back at home, Tony finds a framed photograph of Ziva and himself on a trip to Paris. When Tali sees the photo, she points to Ziva and says, “Ima,” which is Hebrew for “Mother.” Tony is then shocked when his daughter points to him and says, “Aba,” which is Hebrew for “Father.” He just assumed Ziva hadn’t mentioned him to Tali, but it seems Tali knows exactly who he is. Tony decides to put Ziva’s Star of David necklace on their daughter.

Tony has to get back to business when the team tracks down Kort. The criminal claims he didn’t know Ziva would be there, but Tony is livid. When Kort reaches for his gun, DiNozzo and the rest of the team shoot him, several more times than is actually necessary.

Gibbs DiNozzo Gibbs (Mark Harmon) and DiNozzo (Michael Weatherly) share a heartfelt goodbye in the “NCIS” Season 13 finale. Photo: CBS

With Kort dead, Tony is ready to retire. He just wants to take care of his daughter, and he can’t risk his life knowing that she depends on him. “I’ve never been anybody’s everything before,” Tony tells Gibbs.

Tony says he is going to do some traveling and take Tali to Paris, one of Ziva’s favorite cities. Gibbs understands and even appears to have anticipated the news.

Abby also shares a heartfelt goodbye with DiNozzo. She tells him Ziva told her how much she loved Tony.

Tony packs up his desk and says goodbye to all of his friends. He heads into the elevator to start his life post-“NCIS.”