"I hate to be the one to tell you this, but I told you so," a jubilant Birkhead said after a closed-door hearing. "My baby's going to be coming home pretty soon. I'm the father."
He then hugged his rival, Howard K. Stern. Stern, Smith's lawyer-turned-companion, has been caring for 7-month-old Dannielynn since the former Playboy Playmate's sudden death in February, and his name is on her birth certificate.
Stern had said he believed he was the father of the little girl, who could inherit millions.
FOX Facts: Timeline of Facts on Anna Nicole's Baby, Dannielynn
"I'm obviously very disappointed but my feelings toward Dannielynn have not changed," Stern said after the hearing, adding that Birkhead can come to his Bahamas home to visit Dannielynn at any time.
"I'm going to do my best to make sure the best interests of Dannielynn are carried out — and I'm going to do my best to see that [Birkhead] gets sole custody."
Smith's estranged mother Virgie Arthur has also been fighting for custody.
"All I care about is the saftey and well-being of my granddaughter Dannielynn," Arthur said after the hearing. A lawyer for Arthur indicated she might seek joint custody at another hearing on Friday.
An expert in genetic evidence said the DNA analysis has proven Birkhead is Dannielynn's father. Dr. Michael Baird, who analyzed the results of a March 21 DNA test, announced the results outside the court. "Essentially, he's the biological father," Baird said.
Earlier Tuesday, as Birkhead entered the pale pink colonial courthouse in downtown Nassau, he gestured to his large entourage of family members: "I've got a large group of people here and I'm hoping to leave with one more," he said.
Stern's lawyer said earlier Tuesday that if Birkhead was found to be the father, Stern would relinquish custody of the girl to him and the two men would "cooperate in transitioning the child."
"I think they have some understanding about how they're going to deal with it," James Neavitt, an attorney for Stern, told The Associated Press.
Birkhead, a Los Angeles photographer, began seeking custody before the reality TV star collapsed and died in a Florida hotel on Feb. 8.
The baby, whose full name is Dannielynn Hope Marshall Stern, could inherit millions from the estate of Smith's late husband, J. Howard Marshall II. The former model had been fighting the Texas oil tycoon's family over his estimated $500 million fortune since his death in 1995.
In other news, Stern has hired a lawyer who said Monday he may sue media Stern believes are implicating him in the overdose deaths of Smith and her son.
"The nightly television, tabloid and Internet trial of Mr. Stern in the court of public opinion based on sensational lies, speculation, rumor and gossip is over," Atlanta attorney Lin Wood said in a news release.
A medical examiner ruled Smith died of an accidental overdose of sleeping medication and at least eight other prescription drugs, along with a case of the flu and a bacterial infection from injecting drugs into her buttocks. Most of the drugs were prescribed in Stern's name, the medical examiner found.
Daniel Smith, the model's 20-year-old son, died Sept. 10 as he visited his mother three days after she gave birth in a Bahamian hospital to Dannielynn. Daniel Smith's death was ruled an overdose, but an inquest into whether it was accidental has been put on hold.
The Associated Press contributed to this report.