This paper deals with the study of the optimal control problem for the objective F(x,u,v)=∫T0f(x(t),x(t−h),ζ(t),u(t),v(t),t)dt, with x∈X,u∈U,v∈V;X,U and V being vector spaces, and ζ(t)=∫h0R(t,τ)x(t−τ)dτ subject to the differential equation $\frac{d}{dt}x(t)=m(x(t),x(t-h),\zeta(t),u(t),v(t),t)(0\leq t\leq T)$, and the constraints g1(u(t),t)∈S1,g2(v(t),t)∈S2;n1(x(t),t)∈V1,n2(x(t−h),t)∈V2;n3(ζ(t),t)∈V3(0≤t≤T), where x(t)∈Rn;ζ(t)∈Rn;u(t)∈Rk;f,m,gi(i=1,2),ni(1≤i≤3) and the entries to r(t,τ):R+×R+→L(X,X) are continuously differentiable functions. It is assumed that boundary conditions x(0)=x(T)=0 are imposed. Si(i=1;2) and Vi(1≤i≤3) are convex cones. The existence of a time-optimal control in analytic linear systems is also investigated via an extension of the bang-bang principle.