I'm not sure if this is the right place for this question, mods please, move it to the right location if so. 
Well, to the question. I was watching First Contact earlier today again and there was the Defiant with Worf, the last couple of times I watched FC I wasn't into DS9 yet, so I guess I just overlooked it, but anyway, when does First Contact takes place on the DS9 timeline?
I know DS9 is commissioned by the time of TNG's seventh season, and Worf is only assigned to it by the time of its forth season... Now, wasn't the Defiant's original function to fight off Borg attacks? Also when it comes the time to fight the Borg they send Worf and a couple of random people. Not only that, but even if First Contact were to take place after the Dominion war, meaning the ending of DS9, what was Worf doing there? Wasn't he suppose to be back on the Klingon Empire with Martok hunting Targs and stuff? And even if it were to take place in the middle of the Dominion War (which I believe is the closest explanation) when did they had the chance to break off the Defiant from the front line and go save Earth from... one Borg ship...?
Thinking about it, the closes explanation I can get is that FC was released in '96, while DS9 ended in '99, so I guess it's somewhat plausible, but yet pretty confusing. But anyway, does anyone know exactly when are the movies, especially FC, are suppose to take place on the DS9 timeline?
Thanks in advance.

Well, to the question. I was watching First Contact earlier today again and there was the Defiant with Worf, the last couple of times I watched FC I wasn't into DS9 yet, so I guess I just overlooked it, but anyway, when does First Contact takes place on the DS9 timeline?
I know DS9 is commissioned by the time of TNG's seventh season, and Worf is only assigned to it by the time of its forth season... Now, wasn't the Defiant's original function to fight off Borg attacks? Also when it comes the time to fight the Borg they send Worf and a couple of random people. Not only that, but even if First Contact were to take place after the Dominion war, meaning the ending of DS9, what was Worf doing there? Wasn't he suppose to be back on the Klingon Empire with Martok hunting Targs and stuff? And even if it were to take place in the middle of the Dominion War (which I believe is the closest explanation) when did they had the chance to break off the Defiant from the front line and go save Earth from... one Borg ship...?
Thinking about it, the closes explanation I can get is that FC was released in '96, while DS9 ended in '99, so I guess it's somewhat plausible, but yet pretty confusing. But anyway, does anyone know exactly when are the movies, especially FC, are suppose to take place on the DS9 timeline?
Thanks in advance.