Steven Vander Ark set up The Harry Potter Lexicon fan website in 2000
The author of an unofficial Harry Potter encyclopaedia broke down as he faced JK Rowling in court in a battle over the right to publish his book.
Steven Vander Ark said his only goal was to celebrate Rowling, sitting in front of him, who he called a "genius".
Rowling had earlier told the court his plans to publish The Harry Potter Lexicon amounted to "wholesale theft".
She is suing Mr Vander Ark and his publisher RDR Books in New York for copyright infringement.
Asked whether he still thought of himself as part of the Harry Potter fan community, Mr Vander Ark struggled to speak through tears.
"I do," he said. "It's been... it's been difficult because there's been a lot of criticism, obviously, but... it has been an important part of my life for the last nine years or so."
JK Rowling has discussed plans to write her own Potter encyclopaedia
Mr Vander Ark set up The Harry Potter Lexicon fan site, a detailed guide to the characters, spells and creatures from Rowling's magical stories, in 2000.
He told the US District Court in Manhattan it was a hobby until RDR Books approached him to publish a print version last year.
Mr Vander Ark said he was initially against the idea, partly because he thought it would violate copyright law, but was reassured by RDR that they could publish legally.
The 50-year-old librarian said he had read every Harry Potter book "30 or 40 times" and read every article ever written about Rowling.
He also said he was working on two more books about the Harry Potter universe.
In response to Mr Vander Ark's testimony, a spokesman for Rowling and Warner Bros said in a statement: "A fan's affectionate enthusiasm should not obscure acts of plagiarism.
"The publishers knew what they were doing."
'Act of betrayal'
On Monday, Rowling told the court she had stopped work on a new novel because her legal concerns had "decimated my creative work".
She denied the case was about money and accused Mr Vander Ark of "an act of betrayal" in using her fiction as the basis for his guide.
"He has simply taken it and copied it," she said. "It is sloppy, lazy and it takes my work wholesale."
Rowling and Warner Bros are seeking to block publication of The Harry Potter Lexicon and are seeking damages for copyright and federal trademark infringement.
Warner Bros is owned by Time Warner Inc, which owns the copyright and trademark rights to the Harry Potter books.